</div> <div class = "control-group"> <div class = "control-label"> <?php print _JSHOP_SEARCH_MANUFACTURERS; ?> </div> <div class = "controls"> <?php print $this->list_manufacturers; ?> </div> </div> <?php if (getDisplayPriceShop()) { ?> <div class = "control-group"> <div class = "control-label"> <?php print _JSHOP_SEARCH_PRICE_FROM; ?> </div> <div class = "controls"> <input type = "text" class = "input" name = "price_from" id = "price_from" /> <?php print $this->config->currency_code; ?> </div> </div> <div class = "control-group">
function add() { header("Cache-Control: no-cache, must-revalidate"); $jshopConfig = JSFactory::getConfig(); if ($jshopConfig->user_as_catalog || !getDisplayPriceShop()) { return 0; } $ajax = JRequest::getInt('ajax'); $product_id = JRequest::getInt('product_id'); $category_id = JRequest::getInt('category_id'); if ($jshopConfig->use_decimal_qty) { $quantity = floatval(str_replace(",", ".", JRequest::getVar('quantity', 1))); $quantity = round($quantity, $jshopConfig->cart_decimal_qty_precision); } else { $quantity = JRequest::getInt('quantity', 1); } $to = JRequest::getVar('to', "cart"); if ($to != "cart" && $to != "wishlist") { $to = "cart"; } $jshop_attr_id = JRequest::getVar('jshop_attr_id'); if (!is_array($jshop_attr_id)) { $jshop_attr_id = array(); } foreach ($jshop_attr_id as $k => $v) { $jshop_attr_id[intval($k)] = intval($v); } $freeattribut = JRequest::getVar("freeattribut"); if (!is_array($freeattribut)) { $freeattribut = array(); } $cart = JSFactory::getModel('cart', 'jshop'); $cart->load($to); if (!$cart->add($product_id, $quantity, $jshop_attr_id, $freeattribut)) { if ($ajax) { print getMessageJson(); die; } $session = JFactory::getSession(); $back_value = array('pid' => $product_id, 'attr' => $jshop_attr_id, 'freeattr' => $freeattribut, 'qty' => $quantity); $session->set('product_back_value', $back_value); $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $category_id . '&product_id=' . $product_id, 1, 1)); return 0; } if ($ajax) { print getOkMessageJson($cart); die; } if ($jshopConfig->not_redirect_in_cart_after_buy) { if ($to == "wishlist") { $message = _JSHOP_ADDED_TO_WISHLIST; } else { $message = _JSHOP_ADDED_TO_CART; } $this->setRedirect($_SERVER['HTTP_REFERER'], $message); return 1; } if ($to == "wishlist") { $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=wishlist&task=view', 1, 1)); } else { $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 0, 1)); } }
public static function checkAdd() { $jshopConfig = JSFactory::getConfig(); return !$jshopConfig->user_as_catalog && getDisplayPriceShop(); }