$jsVars  = ' jQuery(document).ready(function(){
	jQuery(".vmCartModule").productUpdate();
});' ;
//vmJsApi::addJScript('vm.CartModule.UpdateProduct',$jsVars);


//This is strange we have the whole thing again in controllers/cart.php public function viewJS()
if(!class_exists('VirtueMartCart')) require(VMPATH_SITE.DS.'helpers'.DS.'cart.php');
$cart = VirtueMartCart::getCart(false);

$viewName = vRequest::getString('view',0);
if($viewName=='cart'){
	$checkAutomaticPS = true;
} else {
	$checkAutomaticPS = false;
}
$data = $cart->prepareAjaxData($checkAutomaticPS);

if (!class_exists('CurrencyDisplay')) require(VMPATH_ADMIN . DS. 'helpers' . DS . 'currencydisplay.php');
$currencyDisplay = CurrencyDisplay::getInstance( );

vmJsApi::cssSite();

$moduleclass_sfx = $params->get('moduleclass_sfx', '');
$show_price = (bool)$params->get( 'show_price', 1 ); // Display the Product Price?
$show_product_list = (bool)$params->get( 'show_product_list', 1 ); // Display the Product Price?

require(JModuleHelper::getLayoutPath('mod_virtuemart_cart'));
echo vmJsApi::writeJS();
 ?>
 /**
  * Plugin that returns the object list for DJ-Mediatools album
  * 
  * Each object must contain following properties (mandatory): title, description, image
  * Optional properties: link, target (_blank or _self), alt (alt attribute for image)
  * 
  * @param	object	The album params
  */
 public function onAlbumPrepare(&$source, &$params)
 {
     // Lets check the requirements
     $check = $this->onCheckRequirements($source);
     if (is_null($check) || is_string($check)) {
         return null;
     }
     $app = JFactory::getApplication();
     // Load the language file of com_virtuemart.
     JFactory::getLanguage()->load('com_virtuemart');
     /* Load  VM fonction */
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     VmConfig::loadJLang('mod_virtuemart_product', true);
     include_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'tables' . DS . 'categories.php';
     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');
     }
     $category_id = $params->get('plg_virtuemart_category_id', null);
     $product_group = $params->get('plg_virtuemart_product_group', 'latest');
     $max_items = $params->get('max_images');
     $show_price = (bool) $params->get('plg_virtuemart_show_price', 1);
     $show_addtocart = (bool) $params->get('plg_virtuemart_show_addtocart', 1);
     $default_image = $params->get('plg_virtuemart_image');
     $filter_category = $category_id ? TRUE : FALSE;
     $productModel = VmModel::getModel('Product');
     $products = $productModel->getProductListing($product_group, $max_items, $show_price, true, false, $filter_category, $category_id);
     $productModel->addImages($products);
     //$this->debug($productModel);
     $currency = CurrencyDisplay::getInstance();
     if ($show_addtocart) {
         vmJsApi::jPrice();
         vmJsApi::cssSite();
     }
     //$this->debug($products);
     $slides = array();
     foreach ($products as $product) {
         $slide = (object) array();
         //$this->debug($product->images);
         if (isset($product->images[0])) {
             $slide->image = $product->images[0]->file_url;
         } else {
             if ($default_image) {
                 $slide->image = $default_image;
             } else {
                 continue;
             }
         }
         $slide->title = $product->product_name;
         $slide->description = $product->product_s_desc;
         if (empty($slide->description)) {
             $slide->description = $product->product_desc;
         }
         $slide->canonical = $slide->link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id);
         $slide->id = $product->virtuemart_product_id . ':' . $product->slug;
         if ($comments = $params->get('commnets', 0)) {
             $host = str_replace(JURI::root(true), '', JURI::root());
             $host = preg_replace('/\\/$/', '', $host);
             switch ($comments) {
                 case 1:
                     // jcomments
                     $slide->comments = array('id' => $item->virtuemart_product_id, 'group' => 'com_virtuemart');
                     break;
                 case 2:
                     // disqus
                     $disqus_shortname = $params->get('disqus_shortname', '');
                     if (!empty($disqus_shortname)) {
                         $slide->comments = array();
                         $slide->comments['url'] = $host . $slide->link;
                         $slide->comments['identifier'] = $disqus_shortname . '-virtuemart-' . $item->virtuemart_product_id;
                         // ??
                     }
                     break;
                 case 3:
                     // facebook
                     $slide->comments = $host . $slide->link;
                     break;
                 case 4:
                     //komento
                     // not implemented
                     break;
             }
         }
         if ($show_price && isset($product->prices)) {
             $slide->extra = '<div class="vmproduct"><div class="product-price">' . $currency->createPriceDiv('salesPrice', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
             if (!empty($product->prices['salesPriceWithDiscount'])) {
                 $slide->extra .= $currency->createPriceDiv('salesPriceWithDiscount', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
             }
             $slide->extra .= '</div>';
         }
         if ($show_addtocart) {
             if (!isset($slide->extra)) {
                 $slide->extra = '<div class="vmproduct">';
             }
             ob_start();
             echo $this->addtocart($product);
             $slide->extra .= ob_get_clean();
         }
         if (isset($slide->extra)) {
             $slide->extra .= '</div>';
         }
         $slides[] = $slide;
     }
     return $slides;
 }
示例#3
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);
    }
示例#4
0
    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>' : '';
    }
示例#5
0
 /**
  * Prepares the document
  */
 protected function _prepareDocument()
 {
     //JHTML::stylesheet('vmsite-ltr.css',JURI::base().'components/com_virtuemart/assets/css/');
     //JHTML::script('jquery.min.js','http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/');
     //JHTML::script('jquery-ui.min.js','http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/');
     //use the vm functions for loading scripts and css
     if (!class_exists('VmConfig')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     vmJsApi::cssSite();
     vmJsApi::jSite();
     //layout
     $this->_setPath('template', JPATH_BASE . DS . 'components' . DS . 'com_virtuemart' . DS . 'views' . DS . 'category' . DS . 'tmpl');
     $params = JComponentHelper::getParams('com_customfilters');
     $layout = $params->get('cfresults_layout');
     $this->setLayout($layout);
     //echo $layout;
     $title = $params->get('results_page_title', JText::_('CF_SEARCH_RESULTS'));
     $this->document->setTitle($title);
     //add pathway
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     $pathway->addItem($title);
     //load the virtuemart language files
     $language = JFactory::getLanguage();
     $language->load('com_virtuemart');
 }