Exemple #1
0
    function get_store($config, $id)
    {
        if ($this->mode != 'com_virtuemart') {
            return array("price" => '', "cart" => '');
        } else {
            // if the VM is available
            if (!class_exists('VmConfig')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
            }
            VmConfig::loadConfig();
            // Load the language file of com_virtuemart.
            JFactory::getLanguage()->load('com_virtuemart');
            // load necessary classes
            if (!class_exists('calculationHelper')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
            }
            if (!class_exists('CurrencyDisplay')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
            }
            if (!class_exists('VirtueMartModelVendor')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
            }
            if (!class_exists('VmImage')) {
                require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
            }
            if (!class_exists('shopFunctionsF')) {
                require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
            }
            if (!class_exists('calculationHelper')) {
                require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
            }
            if (!class_exists('VirtueMartModelProduct')) {
                JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
            }
            // load the base
            $productModel = new VirtueMartModelProduct();
            $product = $productModel->getProduct($id, 100, true, true, true);
            $currency = CurrencyDisplay::getInstance();
            $price = '<strong>' . $currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices, true) . '</strong>';
            if ($config['vm_add_to_cart'] == 1) {
                vmJsApi::jPrice();
                vmJsApi::writeJS();
            }
            $news_price = '<div class="PricebasePriceWithTax">';
            //
            if ($config['vm_show_price_type'] != 'none') {
                if ($config['vm_display_type'] == 'text_price') {
                    $news_price .= '<span class="PricebasePriceWithTax">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE') . ' ' . $price . '</span>';
                } else {
                    $news_price .= '<span class="PricebasePriceWithTax">' . $price . '</span>';
                }
            }
            $news_price .= '</div>';
            // display discount
            if ($config['vm_show_discount_amount'] == 1) {
                $disc_amount = $currency->priceDisplay($product->prices['discountAmount'], $currency->getId());
                $news_price .= '<div class="PricetaxAmount">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_DISCOUNT_AMOUNT') . $disc_amount . '</div>';
            }
            // display tax
            if ($config['vm_show_tax'] == 1) {
                $taxAmount = $currency->priceDisplay($product->prices['taxAmount'], $currency->getId());
                $news_price .= '<div class="PricetaxAmount">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT') . $taxAmount . '</div>';
            }
            $news_cart = '';
            // 'Add to cart' button
            if ($config['vm_add_to_cart'] == 1) {
                $code = '<div class="addtocart-area">';
                $code .= '<form method="post" class="product" action="index.php">';
                $code .= '<div class="addtocart-bar">';
                $code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>';
                $addtoCartButton = '';
                if ($product->addToCartButton) {
                    $addtoCartButton = $product->addToCartButton;
                } else {
                    $addtoCartButton = shopFunctionsF::getAddToCartButton($product->orderable);
                }
                $code .= $addtoCartButton;
                $code .= '</div>
	                    <input type="hidden" class="pname" value="' . $product->product_name . '"/>
	                    <input type="hidden" name="option" value="com_virtuemart" />
	                    <input type="hidden" name="view" value="cart" />
	                    <input type="hidden" name="task" value="add" />
	                    <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
	                    <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
	                </form>';
                $code .= '</div>';
                $news_cart .= $code;
            }
            // results
            return array("price" => $news_price, "cart" => $news_cart);
        }
    }
Exemple #2
0
}
// Get product ids
//$productIds = $product->sortSearchListQuery ($onlyPublished = TRUE, $product->virtuemart_category_id = FALSE, $group = FALSE, $nbrReturnProducts);
$productIds = $product->sortSearchListQuery_Lang($onlyPublished = TRUE, $product->virtuemart_category_id = FALSE, $group = FALSE, $nbrReturnProducts, 'de_de');
$current_id = 0;
$prod_count = 0;
//Print Header
print "name;desc;price;msrp;currency;sizes;category;images_url;gender;brand;product_url;internal_id;fabric;color;mpn\n";
// Go trough all products
foreach ($productIds as $id) {
    // Display products in current page
    if ($pagination == "on" && ($prod_count < $_start || $prod_count > $_end)) {
        $prod_count++;
        continue;
    }
    if ($productItem = $product->getProduct((int) $id, $front = TRUE, $withCalc = TRUE, $onlyPublished = TRUE)) {
        $image_url = "";
        if (is_array($productItem->virtuemart_media_id) && !empty($productItem->virtuemart_media_id)) {
            foreach ($productItem->virtuemart_media_id as $immagine) {
                $image->setId($immagine);
                //var_dump($image);
                $image_url = $image_url . $image->getFile()->file_url . '|';
            }
            //$image_url = $image->getFile()->file_url;
        } else {
            $image_url = "";
        }
        $categorie = array();
        $categoria = array();
        $categorie = $product->getProductCategories((int) $productItem->virtuemart_product_id, FALSE);
        $categoria[] = $categorie[2];
Exemple #3
0
    static function store($config, $item)
    {
        // Load the language file of com_virtuemart.
        JFactory::getLanguage()->load('com_virtuemart');
        // Load path constant
        if (!defined('VMPATH_ADMIN')) {
            define('VMPATH_ADMIN', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart');
        }
        // Load VM configuration if necessary
        if (!class_exists('VmConfig')) {
            require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
            VmConfig::loadConfig();
        }
        // load necessary classes
        if (!class_exists('calculationHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
        }
        if (!class_exists('CurrencyDisplay')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
        }
        if (!class_exists('VirtueMartModelVendor')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
        }
        if (!class_exists('VmImage')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
        }
        if (!class_exists('shopFunctionsF')) {
            require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
        }
        if (!class_exists('calculationHelper')) {
            require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
        }
        if (!class_exists('VirtueMartModelProduct')) {
            JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
        }
        // load the base
        $productModel = new VirtueMartModelProduct();
        $product = $productModel->getProduct($item['id'], 100, true, true, true);
        $currency = CurrencyDisplay::getInstance();
        $price = '<strong>' . $currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices, true) . '</strong>';
        if ($config['vm_add_to_cart'] == 1 && JRequest::getCmd('option') != 'com_virtuemart') {
            vmJsApi::jPrice();
            vmJsApi::addJScript('facebox');
            vmJsApi::css('facebox');
            vmJsApi::writeJS();
        }
        $news_price = '<div>';
        //
        if ($config['vm_show_price_type'] != 'none') {
            if ($config['vm_display_type'] == 'text_price') {
                $news_price .= '<span>' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE') . ' ' . $price . '</span>';
            } else {
                $news_price .= '<span>' . $price . '</span>';
            }
        }
        // 'Add to cart' button
        if ($config['vm_add_to_cart'] == 1) {
            if (isset($product->customfields) && count($product->customfields)) {
                foreach ($product->customfields as $field) {
                    if (isset($field->is_cart_attribute) && $field->is_cart_attribute == 1 || isset($field->layout_pos) && $field->layout_pos == 'addtocart') {
                        $product->orderable = 0;
                        break;
                    }
                }
            }
            $code = '<div class="addtocart-area">';
            if ($product->orderable != 0) {
                $code .= '<form method="post" class="product" action="index.php">';
            } else {
                $code .= '<form method="post" class="product-variant" action="' . static::itemLink($item, $config) . '">';
            }
            $code .= '<div class="addtocart-bar">';
            $code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>';
            $addtoCartButton = '';
            if ($product->addToCartButton) {
                $addtoCartButton = $product->addToCartButton;
            } else {
                $addtoCartButton = shopFunctionsF::getAddToCartButton($product->orderable);
            }
            $code .= str_replace('addtocart-button-disabled"', 'addtocart-button" type="submit"', $addtoCartButton);
            if ($product->orderable != 0) {
                $code .= '</div>
	                    <input type="hidden" class="pname" value="' . $product->product_name . '"/>
	                    <input type="hidden" name="option" value="com_virtuemart" />
	                    <input type="hidden" name="view" value="cart" />
	                    <noscript><input type="hidden" name="task" value="add" /></noscript>
	                    <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
	                    <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
	                </form>';
            } else {
                $code .= '</div></form>';
            }
            $code .= '</div>';
            $news_price .= $code;
        }
        // display discount
        if ($config['vm_show_discount_amount'] == 1) {
            $disc_amount = $currency->priceDisplay($product->prices['discountAmount'], $currency->getId());
            $news_price .= '<small class="nspDiscount">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_DISCOUNT_AMOUNT') . $disc_amount . '</small>';
        }
        // display tax
        if ($config['vm_show_tax'] == 1) {
            $taxAmount = $currency->priceDisplay($product->prices['taxAmount'], $currency->getId());
            $news_price .= '<small class="nspTax">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT') . $taxAmount . '</small>';
        }
        // results
        return $news_price != '<div>' ? $news_price . '</div>' : '';
    }
Exemple #4
0
    function get_store($config, $id)
    {
        // if the VM is available
        if (!class_exists('VmConfig')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
        }
        VmConfig::loadConfig();
        // Load the language file of com_virtuemart.
        JFactory::getLanguage()->load('com_virtuemart');
        // load necessary classes
        if (!class_exists('calculationHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
        }
        if (!class_exists('CurrencyDisplay')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
        }
        if (!class_exists('VirtueMartModelVendor')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
        }
        if (!class_exists('VmImage')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
        }
        if (!class_exists('shopFunctionsF')) {
            require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
        }
        if (!class_exists('calculationHelper')) {
            require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
        }
        if (!class_exists('VirtueMartModelProduct')) {
            JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
        }
        // load the base
        $mainframe = JFactory::getApplication();
        $virtuemart_currency_id = $mainframe->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0));
        $currency = CurrencyDisplay::getInstance();
        $cSymbol = $currency->getSymbol();
        $cDecimals = $currency->getNbrDecimals();
        $cDecSymbol = $currency->getDecimalSymbol();
        //
        $productModel = new VirtueMartModelProduct();
        $product = $productModel->getProduct($id, 100, true, true, true);
        $price = strip_tags($currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices));
        // remove currency
        $price = str_replace($cSymbol, '', $price);
        // prepare price - apply correct format and decimal separator
        $price = str_replace('.', $cDecSymbol, $price);
        if ($config['vm_currency_position'] == 'before') {
            $price = $cSymbol . ' ' . $price;
        } else {
            $price = $price . ' ' . $cSymbol;
        }
        //
        if ($config['vm_add_to_cart'] == 1) {
            vmJsApi::jQuery();
            vmJsApi::jPrice();
        }
        $news_price = '<div class="PricebasePriceWithTax">';
        //
        if ($config['vm_show_price_type'] != 'none') {
            if ($config['vm_display_type'] == 'text_price') {
                $news_price .= '<span class="PricebasePriceWithTax">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE') . ' ' . $price . '</span>';
            } else {
                $news_price .= '<span class="PricebasePriceWithTax">' . $price . '</span>';
            }
        }
        $news_price .= '</div>';
        // display discount
        if ($config['vm_show_discount_amount'] == 1) {
            $news_price .= '<div class="PricetaxAmount">';
            $disc_amount = str_replace('.', $cDecSymbol, number_format($product->prices['discountAmount'], $cDecimals));
            if ($config['vm_currency_position'] == 'before') {
                $disc_amount = $cSymbol . ' ' . $disc_amount;
            } else {
                $disc_amount = $disc_amount . ' ' . $cSymbol;
            }
            $news_price .= JText::_('MOD_NEWS_PRO_GK5_PRODUCT_DISCOUNT_AMOUNT') . $disc_amount;
            $news_price .= '</div>';
        }
        // display tax
        if ($config['vm_show_tax'] == 1) {
            $news_price .= '<div class="PricetaxAmount">';
            $taxAmount = str_replace('.', $cDecSymbol, number_format($product->prices['taxAmount'], $cDecimals));
            if ($config['vm_currency_position'] == 'before') {
                $taxAmount = $cSymbol . ' ' . $taxAmount;
            } else {
                $taxAmount = $taxAmount . ' ' . $cSymbol;
            }
            $news_price .= JText::_('MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT') . $taxAmount;
            $news_price .= '</div>';
        }
        // 'Add to cart' button
        $news_cart = '';
        //if($config['vm_add_to_cart'] == 1) {
        $code = '<form method="post" class="product" action="index.php">';
        $code .= '<div class="addtocart-bar">';
        $code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>';
        $button_lbl = JText::_('MOD_NEWS_PRO_GK5_COM_VIRTUEMART_CART_ADD_TO');
        $button_cls = '';
        $stockhandle = VmConfig::get('stockhandle', 'none');
        $code .= '<span class="addtocart-button"><input type="submit" name="addtocart" class="addtocart-button" value="' . $button_lbl . '" title="' . $button_lbl . '" /></span>';
        $code .= '</div>
	                <input type="hidden" class="pname" value="' . $product->product_name . '"/>
	                <input type="hidden" name="option" value="com_virtuemart" />
	                <input type="hidden" name="view" value="cart" />
	                <noscript><input type="hidden" name="task" value="add" /></noscript>
	                <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
	                <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
	            </form>';
        $news_cart .= $code;
        //}
        // restults
        return array("price" => $news_price, "cart" => $news_cart);
    }
    function store_vm($config, $news_id, $news_cid, $news_price, $news_price_currency, $news_discount_amount, $news_discount_is_percent, $news_discount_start, $news_discount_end, $news_tax, $news_manufacturer)
    {
        //
        if (!class_exists('VmConfig')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
        }
        VmConfig::loadConfig();
        // Load the language file of com_virtuemart.
        JFactory::getLanguage()->load('com_virtuemart');
        if (!class_exists('calculationHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
        }
        if (!class_exists('CurrencyDisplay')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
        }
        if (!class_exists('VirtueMartModelVendor')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
        }
        if (!class_exists('VmImage')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
        }
        if (!class_exists('shopFunctionsF')) {
            require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
        }
        if (!class_exists('calculationHelper')) {
            require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
        }
        if (!class_exists('VirtueMartModelProduct')) {
            JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
        }
        $mainframe = Jfactory::getApplication();
        $virtuemart_currency_id = $mainframe->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0));
        $currency = CurrencyDisplay::getInstance();
        $productModel = new VirtueMartModelProduct();
        $product = $productModel->getProduct($news_id, 100, true, true, true);
        if ($config['vm_add_to_cart'] == 1) {
            vmJsApi::jQuery();
            vmJsApi::jPrice();
            vmJsApi::cssSite();
        }
        $news_price = '';
        if ($config['vm_show_price_type'] != 'none' && $config['vm_show_price_type'] == 'base') {
            if ($config['vm_show_price_with_tax'] == 1) {
                if ($config['vm_display_type'] == 'text_price') {
                    $news_price .= $currency->createPriceDiv('basePriceWithTax', 'MOD_NEWS_PRO_GK4_PRODUCT_BASEPRICE_WITHTAX', $product->prices);
                } else {
                    $news_price .= $currency->createPriceDiv('basePriceWithTax', '', $product->prices);
                }
            } else {
                if ($config['vm_display_type'] == 'text_price') {
                    $news_price .= $currency->createPriceDiv('priceWithoutTax', 'MOD_NEWS_PRO_GK4_PRODUCT_BASEPRICE_WITHOUTTAX', $product->prices);
                } else {
                    $news_price .= $currency->createPriceDiv('priceWithoutTax', '', $product->prices);
                }
            }
        }
        if ($config['vm_show_price_type'] != 'none' && $config['vm_show_price_type'] == 'sale') {
            if ($config['vm_show_price_with_tax'] == 1) {
                if ($config['vm_display_type'] == 'text_price') {
                    $news_price .= $currency->createPriceDiv('salesPrice', 'MOD_NEWS_PRO_GK4_PRODUCT_SALESPRICE', $product->prices);
                } else {
                    $news_price .= $currency->createPriceDiv('salesPrice', '', $product->prices);
                }
            } else {
                if ($config['vm_display_type'] == 'text_price') {
                    $news_price .= $currency->createPriceDiv('priceWithoutTax', 'MOD_NEWS_PRO_GK4_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
                } else {
                    $news_price .= $currency->createPriceDiv('priceWithoutTax', '', $product->prices);
                }
            }
        }
        if ($config['vm_add_to_cart'] == 1) {
            $code = '';
            $code .= '<form method="post" class="product" action="index.php">';
            $code .= '<div class="addtocart-bar">';
            $code .= '<span class="quantity-box" style="display: none">
			<input type="text" class="quantity-input" name="quantity[]" value="1" />
			</span>';
            $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
            $button_cls = '';
            $stockhandle = VmConfig::get('stockhandle', 'none');
            $code .= '<span class="addtocart-button">
				<input type="submit" name="addtocart" class="addtocart-button" value="' . $button_lbl . '" title="' . $button_lbl . '" /></span>';
            $code .= '<div class="clear"></div></div>
                    <input type="hidden" class="pname" value="' . $product->product_name . '"/>
                    <input type="hidden" name="option" value="com_virtuemart" />
                    <input type="hidden" name="view" value="cart" />
                    <noscript><input type="hidden" name="task" value="add" /></noscript>
                    <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
                    <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
                </form>';
            $news_price .= $code;
        }
        if ($config['vm_show_discount_amount'] == 1) {
            $disc_amount = $currency->createPriceDiv('discountAmount', 'MOD_NEWS_PRO_GK4_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
            $disc_amount = strip_tags($disc_amount, '<div>');
            $news_price .= $disc_amount;
        }
        if ($config['vm_show_tax'] == 1) {
            $taxAmount = $currency->createPriceDiv('taxAmount', 'MOD_NEWS_PRO_GK4_PRODUCT_TAX_AMOUNT', $product->prices);
            $taxAmount = strip_tags($taxAmount, '<div>');
            $news_price .= $taxAmount;
        }
        return $news_price != '' ? '<div class="nspVmStore">' . $news_price . '</div>' : '';
    }
Exemple #6
0
 function getData($number)
 {
     nextendimport('nextend.database.database');
     $db = NextendDatabase::getInstance();
     require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_virtuemart' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'config.php';
     VmConfig::loadConfig();
     $language = $this->_data->get('virtuemartproductssourcelanguage', 'en_gb');
     if (!$language) {
         $language = VMLANG;
     }
     $data = array();
     $category = array_map('intval', explode('||', $this->_data->get('virtuemartproductssourcecategory', '')));
     $query = 'SELECT ';
     $query .= 'prod.virtuemart_product_id AS id, ';
     $query .= 'prod.product_sku AS sku, ';
     $query .= 'prod_ext.product_name AS name, ';
     $query .= 'prod_ext.product_s_desc AS short_description, ';
     $query .= 'prod_ext.product_desc AS description, ';
     $query .= 'prod_ext.slug AS slug, ';
     $query .= 'cat.virtuemart_category_id AS category_id, ';
     $query .= 'cat.category_name, ';
     $query .= 'cat.category_description, ';
     $query .= 'cat.slug AS category_slug, ';
     $query .= 'man.virtuemart_manufacturer_id AS manufacturer_id, ';
     $query .= 'man.mf_name AS manufacturer_name, ';
     $query .= 'man.mf_email AS manufacturer_email, ';
     $query .= 'man.mf_desc AS manufacturer_description, ';
     $query .= 'man.mf_url AS manufacturer_url, ';
     $query .= 'man.slug AS manufacturer_slug, ';
     $query .= 'med.file_url AS image, ';
     $query .= 'med.file_url_thumb AS thumbnail, ';
     $query .= 'prod.hits ';
     $query .= 'FROM #__virtuemart_products AS prod ';
     $query .= 'LEFT JOIN #__virtuemart_products_' . $language . ' AS prod_ext ON prod.virtuemart_product_id = prod_ext.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_product_categories AS cat_x ON cat_x.virtuemart_product_id = prod.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_categories_' . $language . ' AS cat ON cat_x.virtuemart_category_id = cat.virtuemart_category_id ';
     $query .= 'LEFT JOIN #__virtuemart_product_manufacturers AS man_x ON man_x.virtuemart_product_id = prod.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_manufacturers_' . $language . ' AS man ON man_x.virtuemart_manufacturer_id = man.virtuemart_manufacturer_id ';
     $query .= 'LEFT JOIN #__virtuemart_product_medias AS med_x ON med_x.virtuemart_product_id = prod.virtuemart_product_id ';
     $query .= 'LEFT JOIN #__virtuemart_medias AS med ON med_x.virtuemart_media_id = med.virtuemart_media_id ';
     $where = array();
     if (!in_array(0, $category) && count($category) > 0) {
         $where[] = 'cat_x.virtuemart_category_id IN (' . implode(',', $category) . ') ';
     }
     if ($this->_data->get('virtuemartproductssourcepublished', 1)) {
         $where[] = ' prod.published = 1 ';
     }
     if ($this->_data->get('virtuemartproductssourcespecial', 0)) {
         $where[] = ' prod.product_special = 1 ';
     }
     if ($this->_data->get('virtuemartproductssourceinstock', 0)) {
         $where[] = ' prod.product_in_stock > 0 ';
     }
     $where[] = ' med.file_is_downloadable = 0 ';
     $where[] = ' med.file_is_forSale = 0 ';
     if (count($where) > 0) {
         $query .= 'WHERE ' . implode(' AND ', $where) . ' ';
     }
     $order = NextendParse::parse($this->_data->get('virtuemartproductsorder1', 'prod_ext.product_name|*|asc'));
     if ($order[0]) {
         $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' ';
         $order = NextendParse::parse($this->_data->get('virtuemartproductsorder2', 'prod_ext.product_name|*|asc'));
         if ($order[0]) {
             $query .= ', ' . $order[0] . ' ' . $order[1] . ' ';
         }
     }
     $query .= 'LIMIT 0, ' . $number . ' ';
     $db->setQuery($query);
     $result = $db->loadAssocList();
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'product.php';
     $currency = CurrencyDisplay::getInstance();
     for ($i = 0; $i < count($result); $i++) {
         $result[$i]['title'] = $result[$i]['name'];
         $productModel = new VirtueMartModelProduct();
         $p = $productModel->getProduct($result[$i]['id'], TRUE, TRUE, TRUE, 1, false);
         $result[$i]['price'] = $result[$i]['cost_price'] = $currency->createPriceDiv('costPrice', '', $p->prices, true);
         $result[$i]['base_price'] = $currency->createPriceDiv('basePrice', '', $p->prices, true);
         $result[$i]['base_price_variant'] = $currency->createPriceDiv('basePriceVariant', '', $p->prices, true);
         $result[$i]['base_price_with_tax'] = $currency->createPriceDiv('basePriceWithTax', '', $p->prices, true);
         $result[$i]['discounted_price_without_tax'] = $currency->createPriceDiv('discountedPriceWithoutTax', '', $p->prices, true);
         $result[$i]['price_before_tax'] = $currency->createPriceDiv('priceBeforeTax', '', $p->prices, true);
         $result[$i]['sales_price'] = $currency->createPriceDiv('salesPrice', '', $p->prices, true);
         $result[$i]['tax_amount'] = $currency->createPriceDiv('taxAmount', '', $p->prices, true);
         $result[$i]['sales_price_with_discount'] = $currency->createPriceDiv('salesPriceWithDiscount', '', $p->prices, true);
         $result[$i]['sales_price_temp'] = $currency->createPriceDiv('salesPriceTemp', '', $p->prices, true);
         $result[$i]['unit_price'] = $currency->createPriceDiv('unitPrice', '', $p->prices, true);
         $result[$i]['price_without_tax'] = $currency->createPriceDiv('priceWithoutTax', '', $p->prices, true);
         $result[$i]['discount_amount'] = $currency->createPriceDiv('discountAmount', '', $p->prices, true);
         $result[$i]['variant_modification'] = $currency->createPriceDiv('variantModification', '', $p->prices, true);
         $result[$i]['addtocart'] = $result[$i]['url'] = 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $result[$i]['id'] . '&virtuemart_category_id=' . $result[$i]['category_id'];
         $result[$i]['addtocart_label'] = 'View product';
         $result[$i]['category_url'] = 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $result[$i]['category_id'];
         $result[$i]['image'] = JURI::root(false) . '/' . $result[$i]['image'];
         $result[$i]['thumbnail'] = JURI::root(false) . '/' . $result[$i]['thumbnail'];
     }
     return $result;
 }
Exemple #7
0
    function get_store($config, $id)
    {
        // if the VM is available
        if (!class_exists('VmConfig')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
        }
        VmConfig::loadConfig();
        // Load the language file of com_virtuemart.
        JFactory::getLanguage()->load('com_virtuemart');
        // load necessary classes
        if (!class_exists('calculationHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
        }
        if (!class_exists('CurrencyDisplay')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
        }
        if (!class_exists('VirtueMartModelVendor')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
        }
        if (!class_exists('VmImage')) {
            require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
        }
        if (!class_exists('shopFunctionsF')) {
            require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
        }
        if (!class_exists('calculationHelper')) {
            require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
        }
        if (!class_exists('VirtueMartModelProduct')) {
            JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
        }
        // load the base
        $mainframe = JFactory::getApplication();
        $virtuemart_currency_id = $mainframe->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0));
        $currency = CurrencyDisplay::getInstance();
        $productModel = new VirtueMartModelProduct();
        $product = $productModel->getProduct($id, 100, true, true, true);
        //if($config['vm_add_to_cart'] == 1) {
        vmJsApi::jQuery();
        vmJsApi::jPrice();
        vmJsApi::cssSite();
        //}
        $news_price = '';
        $news_price .= $currency->createPriceDiv('basePriceWithTax', '', $product->prices);
        // calculate tax
        $taxAmount = $currency->createPriceDiv('taxAmount', 'MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT', $product->prices);
        $taxAmount = strip_tags($taxAmount, '<div>');
        $news_price .= $taxAmount;
        // 'Add to cart' button
        $news_cart = '';
        //if($config['vm_add_to_cart'] == 1) {
        $code = '<form method="post" class="product" action="index.php">';
        $code .= '<div class="addtocart-bar">';
        $code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>';
        $button_lbl = JText::_('MOD_NEWS_PRO_GK5_COM_VIRTUEMART_CART_ADD_TO');
        $button_cls = '';
        $stockhandle = VmConfig::get('stockhandle', 'none');
        $code .= '<span class="addtocart-button"><input type="submit" name="addtocart" class="addtocart-button" value="' . $button_lbl . '" title="' . $button_lbl . '" /></span>';
        $code .= '</div>
	                <input type="hidden" class="pname" value="' . $product->product_name . '"/>
	                <input type="hidden" name="option" value="com_virtuemart" />
	                <input type="hidden" name="view" value="cart" />
	                <noscript><input type="hidden" name="task" value="add" /></noscript>
	                <input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
	                <input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
	            </form>';
        $news_cart .= $code;
        //}
        // restults
        return array("price" => $news_price, "cart" => $news_cart);
    }