} } ?> "/> </span> <span class="quantity-controls js-recalculate"> <input type="button" class="quantity-controls quantity-plus" /> <input type="button" class="quantity-controls quantity-minus" /> </span> <?php // Display the quantity box END // Display the add to cart button ?> <span class="addtocart-button"> <?php echo shopFunctionsF::getAddToCartButton($this->product->orderable); // Display the add to cart button END ?> </span> <noscript><input type="hidden" name="task" value="add"/></noscript> <?php } ?> <?php } ?> <div class="clear"></div> </div> <?php }
* @version $Id: default_addtocart.php 7833 2014-04-09 15:04:59Z Milbo $ */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); $product = $viewData['product']; if (isset($viewData['rowHeights'])) { $rowHeights = $viewData['rowHeights']; } else { $rowHeights['customfields'] = TRUE; } $addtoCartButton = ''; if (!VmConfig::get('use_as_catalog', 0)) { if ($product->addToCartButton) { $addtoCartButton = $product->addToCartButton; } else { $addtoCartButton = shopFunctionsF::getAddToCartButton($product->orderable); } } $position = 'addtocart'; ?> <div class="addtocart-area"> <form method="post" class="product js-recalculate" action="<?php echo JRoute::_('index.php?option=com_virtuemart', false); ?> "> <?php if (!empty($rowHeights['customfields'])) { echo shopFunctionsF::renderVmSubLayout('customfields', array('product' => $product, 'position' => 'addtocart')); } if (!VmConfig::get('use_as_catalog', 0)) {
function addtocart($product) { if (!VmConfig::get('use_as_catalog', 0)) { $stockhandle = VmConfig::get('stockhandle', 'none'); if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and $product->product_in_stock - $product->product_ordered < 1) { $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY'); $button_cls = 'notify-button'; $button_name = 'notifycustomer'; ?> <div style="display:inline-block;"> <a href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $product->virtuemart_product_id); ?> " class="notify"><?php echo JText::_('COM_VIRTUEMART_CART_NOTIFY'); ?> </a> </div> <?php } else { ?> <div class="addtocart-area"> <form method="post" class="product" action="index.php"> <?php // Product custom_fields if (!empty($product->customfieldsCart)) { ?> <div class="product-fields"> <?php foreach ($product->customfieldsCart as $field) { ?> <div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type; ?> "> <span class="product-fields-title"><b><?php echo $field->custom_title; ?> </b></span> <?php echo JHTML::tooltip($field->custom_tip, $field->custom_title, 'tooltip.png'); ?> <span class="product-field-display"><?php echo $field->display; ?> </span> <span class="product-field-desc"><?php echo $field->custom_field_desc; ?> </span> </div> <?php } ?> </div> <?php } ?> <div class="addtocart-bar"> <?php // Display the quantity box ?> <!-- <label for="quantity<?php echo $product->virtuemart_product_id; ?> " class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?> : </label> --> <span class="quantity-box"> <input type="text" class="quantity-input" name="quantity[]" value="1"/> </span> <span class="quantity-controls"> <input type="button" class="quantity-controls quantity-plus"/> <input type="button" class="quantity-controls quantity-minus"/> </span> <?php // Add the button $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO'); $button_cls = ''; //$button_cls = 'addtocart_button'; ?> <?php // Display the add to cart button ?> <span class="addtocart-button"> <?php echo shopFunctionsF::getAddToCartButton($product->orderable); ?> </span> <div class="clear"></div> </div> <input type="hidden" class="pname" value="<?php echo $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="<?php echo $product->virtuemart_product_id; ?> "/> <input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id; ?> "/> </form> <div class="clear"></div> </div> <?php } } }
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); } }
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>' : ''; }