function view()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $session = JFactory::getSession();
     $params = $mainframe->getParams();
     $ajax = JRequest::getInt('ajax');
     $cart = JModelLegacy::getInstance('cart', 'jshop');
     $cart->load("wishlist");
     $cart->addLinkToProducts(1, "wishlist");
     $cart->setDisplayFreeAttributes();
     $seo = JTable::getInstance("seo", "jshop");
     $seodata = $seo->loadData("wishlist");
     if (getThisURLMainPageShop()) {
         $document = JFactory::getDocument();
         appendPathWay(_JSHOP_WISHLIST);
         if ($seodata->title == "") {
             $seodata->title = _JSHOP_WISHLIST;
         }
         setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     } else {
         setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     }
     $shopurl = SEFLink('index.php?option=com_jshopping&controller=category', 1);
     if ($jshopConfig->cart_back_to_shop == "product") {
         $endpagebuyproduct = xhtmlUrl($session->get('jshop_end_page_buy_product'));
     } elseif ($jshopConfig->cart_back_to_shop == "list") {
         $endpagebuyproduct = xhtmlUrl($session->get('jshop_end_page_list_product'));
     }
     if (isset($endpagebuyproduct) && $endpagebuyproduct) {
         $shopurl = $endpagebuyproduct;
     }
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayWishlist', array(&$cart));
     $view_name = "cart";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("wishlist");
     $view->assign('config', $jshopConfig);
     $view->assign('products', $cart->products);
     $view->assign('image_product_path', $jshopConfig->image_product_live_path);
     $view->assign('image_path', $jshopConfig->live_path);
     $view->assign('no_image', $jshopConfig->noimage);
     $view->assign('href_shop', $shopurl);
     $view->assign('href_checkout', SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1));
     $dispatcher->trigger('onBeforeDisplayWishlistView', array(&$view));
     $view->display();
     if ($ajax) {
         die;
     }
 }
Example #2
0
 function view()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     JPluginHelper::importPlugin('jshopping');
     JPluginHelper::importPlugin('content');
     $dispatcher = JDispatcher::getInstance();
     $page = JRequest::getVar('page');
     switch ($page) {
         case 'agb':
             $pathway = _JSHOP_AGB;
             break;
         case 'return_policy':
             $pathway = _JSHOP_RETURN_POLICY;
             break;
         case 'shipping':
             $pathway = _JSHOP_SHIPPING;
             break;
         case 'privacy_statement':
             $pathway = _JSHOP_PRIVACY_STATEMENT;
             break;
     }
     appendPathWay($pathway);
     $seo = JTable::getInstance("seo", "jshop");
     $seodata = $seo->loadData("content-" . $page);
     if ($seodata->title == "") {
         $seodata->title = $pathway;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $statictext = JTable::getInstance("statictext", "jshop");
     $row = $statictext->loadData($page);
     if (!$row->id) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if ($jshopConfig->use_plugin_content) {
         $obj = new stdClass();
         $params = $mainframe->getParams('com_content');
         $obj->text = $row->text;
         $obj->title = $seodata->title;
         $dispatcher->trigger('onContentPrepare', array('com_content.article', &$obj, &$params, 0));
         $row->text = $obj->text;
     }
     $text = $row->text;
     $dispatcher->trigger('onBeforeDisplayContent', array($page, &$text));
     echo $text;
 }
Example #3
0
 function cancelorder()
 {
     $jshopConfig = JSFactory::getConfig();
     checkUserLogin();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $lang = JSFactory::getLang();
     $mainframe = JFactory::getApplication();
     if (!$jshopConfig->client_allow_cancel_order) {
         return 0;
     }
     $order_id = JRequest::getInt('order_id');
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     appendPathWay(_JSHOP_ORDER_NUMBER . ": " . $order->order_number);
     if ($user->id != $order->user_id) {
         JError::raiseError(500, "Error order number");
     }
     $status = $jshopConfig->payment_status_for_cancel_client;
     if ($order->order_status == $status || in_array($order->order_status, $jshopConfig->payment_status_disable_cancel_client)) {
         $this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=order&order_id=" . $order_id, 0, 1, $jshopConfig->use_ssl));
         return 0;
     }
     $checkout = JModelLegacy::getInstance('checkout', 'jshop');
     $checkout->changeStatusOrder($order_id, $status, 1);
     JPluginHelper::importPlugin('jshoppingorder');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onAfterUserCancelOrder', array(&$order_id));
     $this->setRedirect(SEFLink("index.php?option=com_jshopping&controller=user&task=order&order_id=" . $order_id, 0, 1, $jshopConfig->use_ssl), _JSHOP_ORDER_CANCELED);
 }
 function finish()
 {
     $checkout = JModelLegacy::getInstance('checkout', 'jshop');
     $checkout->checkStep(10);
     $jshopConfig = JSFactory::getConfig();
     $session = JFactory::getSession();
     $order_id = $session->get('jshop_end_order_id');
     $document = JFactory::getDocument();
     $document->setTitle(_JSHOP_CHECKOUT_FINISH);
     appendPathWay(_JSHOP_CHECKOUT_FINISH);
     $statictext = JTable::getInstance("statictext", "jshop");
     $rowstatictext = $statictext->loadData("order_finish_descr");
     $text = $rowstatictext->text;
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayCheckoutFinish', array(&$text, &$order_id));
     if (trim(strip_tags($text)) == "") {
         $text = '';
     }
     $view_name = "checkout";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("finish");
     $view->assign('text', $text);
     $view->display();
     if ($order_id) {
         $order = JTable::getInstance('order', 'jshop');
         $order->load($order_id);
         $pm_method = JTable::getInstance('paymentMethod', 'jshop');
         $payment_method_id = $order->payment_method_id;
         $pm_method->load($payment_method_id);
         $paymentsysdata = $pm_method->getPaymentSystemData();
         $payment_system = $paymentsysdata->paymentSystem;
         if ($payment_system) {
             $pmconfigs = $pm_method->getConfigs();
             $payment_system->complete($pmconfigs, $order, $pm_method);
         }
         $dispatcher->trigger('onAfterDisplayCheckoutFinish', array(&$text, &$order, &$pm_method));
     }
     $cart = JModelLegacy::getInstance('cart', 'jshop');
     $cart->load();
     $cart->getSum();
     $cart->clear();
     $checkout->deleteSession();
 }
Example #5
0
 function products()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $session = JFactory::getSession();
     $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $vendor_id = JRequest::getInt("vendor_id");
     $vendor = JSFactory::getTable('vendor', 'jshop');
     $vendor->load($vendor_id);
     $dispatcher->trigger('onBeforeDisplayVendor', array(&$vendor));
     appendPathWay($vendor->shop_name);
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("vendor-product-" . $vendor_id);
     if (!isset($seodata->title) || $seodata->title == "") {
         $seodata = new stdClass();
         $seodata->title = $vendor->shop_name;
         $seodata->keyword = $vendor->shop_name;
         $seodata->description = $vendor->shop_name;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     $products_page = $jshopConfig->count_products_to_page;
     $count_product_to_row = $jshopConfig->count_products_to_row;
     $context = "jshoping.vendor.front.product";
     $contextfilter = "jshoping.list.front.product.vendor." . $vendor_id;
     $orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int');
     $order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int');
     $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $products_page, 'int');
     if (!$limit) {
         $limit = $products_page;
     }
     $limitstart = JRequest::getInt('limitstart');
     if ($order == 4) {
         $order = 1;
     }
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $field_order = $jshopConfig->sorting_products_field_s_select[$order];
     $filters = getBuildFilterListProduct($contextfilter, array("vendors"));
     $total = $vendor->getCountProducts($filters);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'vendor'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $rows = $vendor->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
     addLinkToProducts($rows, 0, 1);
     foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
         $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
     }
     insertValueInArray($products_page, $jshopConfig->count_product_select);
     foreach ($jshopConfig->count_product_select as $key => $value) {
         $product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value');
     }
     $sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order);
     $product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit);
     $_review = JSFactory::getTable('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     if ($jshopConfig->show_product_list_filters) {
         $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'manufacturer_id', 'name');
         $_manufacturers = JSFactory::getTable('manufacturer', 'jshop');
         $listmanufacturers = $_manufacturers->getList();
         array_unshift($listmanufacturers, $first_el);
         if (isset($filters['manufacturers'][0])) {
             $active_manufacturer = $filters['manufacturers'][0];
         } else {
             $active_manufacturer = '';
         }
         $manufacuturers_sel = JHTML::_('select.genericlist', $listmanufacturers, 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'manufacturer_id', 'name', $active_manufacturer);
         $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'category_id', 'name');
         $categories = buildTreeCategory(1);
         array_unshift($categories, $first_el);
         if (isset($filters['categorys'][0])) {
             $active_category = $filters['categorys'][0];
         } else {
             $active_category = 0;
         }
         $categorys_sel = JHTML::_('select.genericlist', $categories, 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'category_id', 'name', $active_category);
     } else {
         $categorys_sel = null;
         $manufacuturers_sel = null;
     }
     $willBeUseFilter = willBeUseFilter($filters);
     $display_list_products = count($rows) > 0 || $willBeUseFilter;
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "vendor";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("products");
     $view->assign('config', $jshopConfig);
     $view->assign('template_block_list_product', "list_products/list_products.php");
     $view->assign('template_no_list_product', "list_products/no_products.php");
     $view->assign('template_block_form_filter', "list_products/form_filters.php");
     $view->assign('template_block_pagination', "list_products/block_pagination.php");
     $view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir);
     $view->assign('filter_show', 1);
     $view->assign('filter_show_category', 1);
     $view->assign('filter_show_manufacturer', 1);
     $view->assign('pagination', $pagenav);
     $view->assign('pagination_obj', $pagination);
     $view->assign('display_pagination', $pagenav != "");
     $view->assign("rows", $rows);
     $view->assign("count_product_to_row", $count_product_to_row);
     $view->assign("vendor", $vendor);
     $view->assign('action', $action);
     $view->assign('allow_review', $allow_review);
     $view->assign('orderby', $orderby);
     $view->assign('product_count', $product_count_sel);
     $view->assign('sorting', $sorting_sel);
     $view->assign('categorys_sel', $categorys_sel);
     $view->assign('manufacuturers_sel', $manufacuturers_sel);
     $view->assign('filters', $filters);
     $view->assign('willBeUseFilter', $willBeUseFilter);
     $view->assign('display_list_products', $display_list_products);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Example #6
0
 function view()
 {
     $jshopConfig = JSFactory::getConfig();
     if ($jshopConfig->user_as_catalog) {
         return 0;
     }
     $db = JFactory::getDBO();
     $session = JFactory::getSession();
     $mainframe = JFactory::getApplication();
     $params = $mainframe->getParams();
     $ajax = JRequest::getInt('ajax');
     $cart = JSFactory::getModel('cart', 'jshop');
     $cart->load();
     $cart->addLinkToProducts(1);
     $cart->setDisplayFreeAttributes();
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("cart");
     if (getThisURLMainPageShop()) {
         $document = JFactory::getDocument();
         appendPathWay(_JSHOP_CART);
         if ($seodata->title == "") {
             $seodata->title = _JSHOP_CART;
         }
         setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     } else {
         setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     }
     $shopurl = SEFLink('index.php?option=com_jshopping&controller=category', 1);
     if ($jshopConfig->cart_back_to_shop == "product") {
         $endpagebuyproduct = xhtmlUrl($session->get('jshop_end_page_buy_product'));
     } elseif ($jshopConfig->cart_back_to_shop == "list") {
         $endpagebuyproduct = xhtmlUrl($session->get('jshop_end_page_list_product'));
     }
     if ($endpagebuyproduct) {
         $shopurl = $endpagebuyproduct;
     }
     $statictext = JSFactory::getTable("statictext", "jshop");
     $tmp = $statictext->loadData("cart");
     $cartdescr = $tmp->text;
     $weight_product = $cart->getWeightProducts();
     if ($weight_product == 0 && $jshopConfig->hide_weight_in_cart_weight0) {
         $jshopConfig->show_weight_order = 0;
     }
     if ($jshopConfig->shop_user_guest == 1) {
         $href_checkout = SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2&check_login=1', 1, 0, $jshopConfig->use_ssl);
     } else {
         $href_checkout = SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 1, 0, $jshopConfig->use_ssl);
     }
     $tax_list = $cart->getTaxExt(0, 1);
     $show_percent_tax = 0;
     if (count($tax_list) > 1 || $jshopConfig->show_tax_in_product) {
         $show_percent_tax = 1;
     }
     if ($jshopConfig->hide_tax) {
         $show_percent_tax = 0;
     }
     $hide_subtotal = 0;
     if (($jshopConfig->hide_tax || count($tax_list) == 0) && !$cart->rabatt_summ) {
         $hide_subtotal = 1;
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayCart', array(&$cart));
     $view_name = "cart";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("cart");
     $view->assign('config', $jshopConfig);
     $view->assign('products', $cart->products);
     $view->assign('summ', $cart->getPriceProducts());
     $view->assign('image_product_path', $jshopConfig->image_product_live_path);
     $view->assign('image_path', $jshopConfig->live_path);
     $view->assign('no_image', $jshopConfig->noimage);
     $view->assign('href_shop', $shopurl);
     $view->assign('href_checkout', $href_checkout);
     $view->assign('discount', $cart->getDiscountShow());
     $view->assign('free_discount', $cart->getFreeDiscount());
     $view->assign('use_rabatt', $jshopConfig->use_rabatt_code);
     $view->assign('tax_list', $cart->getTaxExt(0, 1));
     $view->assign('fullsumm', $cart->getSum(0, 1));
     $view->assign('show_percent_tax', $show_percent_tax);
     $view->assign('hide_subtotal', $hide_subtotal);
     $view->assign('weight', $weight_product);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $view->assign('cartdescr', $cartdescr);
     $dispatcher->trigger('onBeforeDisplayCartView', array(&$view));
     $view->display();
     if ($ajax) {
         die;
     }
 }
Example #7
0
 function view()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $dispatcher = JDispatcher::getInstance();
     $page = JRequest::getVar('page');
     switch ($page) {
         case 'agb':
             $pathway = _JSHOP_AGB;
             break;
         case 'return_policy':
             $pathway = _JSHOP_RETURN_POLICY;
             break;
         case 'shipping':
             $pathway = _JSHOP_SHIPPING;
             break;
         case 'privacy_statement':
             $pathway = _JSHOP_PRIVACY_STATEMENT;
             break;
     }
     appendPathWay($pathway);
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("content-" . $page);
     if ($seodata->title == "") {
         $seodata->title = $pathway;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $statictext = JSFactory::getTable("statictext", "jshop");
     $order_id = JRequest::getInt('order_id');
     $cartp = JRequest::getInt('cart');
     if ($jshopConfig->return_policy_for_product && $page == 'return_policy' && ($cartp || $order_id)) {
         if ($cartp) {
             $cart = JSFactory::getModel('cart', 'jshop');
             $cart->load();
             $list = $cart->getReturnPolicy();
         } else {
             $order = JSFactory::getTable('order', 'jshop');
             $order->load($order_id);
             $list = $order->getReturnPolicy();
         }
         $listtext = array();
         foreach ($list as $v) {
             $listtext[] = $v->text;
         }
         $row = new stdClass();
         $row->id = -1;
         $row->text = implode('<div class="return_policy_space"></div>', $listtext);
     } else {
         $row = $statictext->loadData($page);
     }
     if (!$row->id) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if ($jshopConfig->use_plugin_content) {
         $obj = new stdClass();
         $params = $mainframe->getParams('com_content');
         $obj->text = $row->text;
         $obj->title = $seodata->title;
         $dispatcher->trigger('onContentPrepare', array('com_content.article', &$obj, &$params, 0));
         $row->text = $obj->text;
     }
     $text = $row->text;
     $dispatcher->trigger('onBeforeDisplayContent', array($page, &$text));
     $view_name = "content";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("content");
     $view->assign('text', $text);
     $dispatcher->trigger('onBeforeDisplayContentView', array(&$view));
     $view->display();
 }
Example #8
0
 function result()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
     $params = $mainframe->getParams();
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JSFactory::getTable('product', 'jshop');
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("search-result");
     if (getThisURLMainPageShop()) {
         appendPathWay(_JSHOP_SEARCH);
         if ($seodata->title == "") {
             $seodata->title = _JSHOP_SEARCH;
         }
         setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     } else {
         setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     }
     $post = JRequest::get('request');
     if (isset($post['setsearchdata']) && $post['setsearchdata'] == 1) {
         $session->set("jshop_end_form_data", $post);
     } else {
         $data = $session->get("jshop_end_form_data");
         if (count($data)) {
             $post = $data;
         }
     }
     $category_id = intval($post['category_id']);
     $manufacturer_id = intval($post['manufacturer_id']);
     if (isset($post['date_to'])) {
         $date_to = $post['date_to'];
     } else {
         $date_to = null;
     }
     if (isset($post['date_from'])) {
         $date_from = $post['date_from'];
     } else {
         $date_from = null;
     }
     if (isset($post['price_to'])) {
         $price_to = saveAsPrice($post['price_to']);
     } else {
         $price_to = null;
     }
     if (isset($post['price_from'])) {
         $price_from = saveAsPrice($post['price_from']);
     } else {
         $price_from = null;
     }
     if (isset($post['include_subcat'])) {
         $include_subcat = intval($post['include_subcat']);
     } else {
         $include_subcat = 0;
     }
     $search = trim($post['search']);
     $search_type = $post['search_type'];
     if (!$search_type) {
         $search_type = "any";
     }
     $context = "jshoping.searclist.front.product";
     $orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int');
     $order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int');
     $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $jshopConfig->count_products_to_page, 'int');
     if (!$limit) {
         $limit = $jshopConfig->count_products_to_page;
     }
     $limitstart = JRequest::getInt('limitstart', 0);
     if ($order == 4) {
         $order = 1;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         if (isset($post['extra_fields'])) {
             $extra_fields = $post['extra_fields'];
         } else {
             $extra_fields = array();
         }
         $extra_fields = filterAllowValue($extra_fields, "array_int_k_v+");
     }
     $categorys = array();
     if ($category_id) {
         if ($include_subcat) {
             $_category = JSFactory::getTable('category', 'jshop');
             $all_categories = $_category->getAllCategories();
             $cat_search[] = $category_id;
             searchChildCategories($category_id, $all_categories, $cat_search);
             foreach ($cat_search as $key => $value) {
                 $categorys[] = $value;
             }
         } else {
             $categorys[] = $category_id;
         }
     }
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $filters = array();
     $filters['categorys'] = $categorys;
     if ($manufacturer_id) {
         $filters['manufacturers'][] = $manufacturer_id;
     }
     $filters['price_from'] = $price_from;
     $filters['price_to'] = $price_to;
     if ($jshopConfig->admin_show_product_extra_field) {
         $filters['extra_fields'] = $extra_fields;
     }
     $adv_query = "";
     $adv_from = "";
     $adv_result = $product->getBuildQueryListProductDefaultResult();
     $product->getBuildQueryListProduct("search", "list", $filters, $adv_query, $adv_from, $adv_result);
     if ($date_to && checkMyDate($date_to)) {
         $adv_query .= " AND prod.product_date_added <= '" . $db->escape($date_to) . "'";
     }
     if ($date_from && checkMyDate($date_from)) {
         $adv_query .= " AND prod.product_date_added >= '" . $db->escape($date_from) . "'";
     }
     $where_search = "";
     if ($search_type == "exact") {
         $word = addcslashes($db->escape($search), "_%");
         $tmp = array();
         foreach ($jshopConfig->product_search_fields as $field) {
             $tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
         }
         $where_search = implode(' OR ', $tmp);
     } else {
         $words = explode(" ", $search);
         $search_word = array();
         foreach ($words as $word) {
             $word = addcslashes($db->escape($word), "_%");
             $tmp = array();
             foreach ($jshopConfig->product_search_fields as $field) {
                 $tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
             }
             $where_search_block = implode(' OR ', $tmp);
             $search_word[] = "(" . $where_search_block . ")";
         }
         if ($search_type == "any") {
             $where_search = implode(" OR ", $search_word);
         } else {
             $where_search = implode(" AND ", $search_word);
         }
     }
     if ($where_search) {
         $adv_query .= " AND ({$where_search})";
     }
     $orderbyf = $jshopConfig->sorting_products_field_s_select[$order];
     $order_query = $product->getBuildQueryOrderListProduct($orderbyf, $orderbyq, $adv_from);
     $dispatcher->trigger('onBeforeQueryGetProductList', array("search", &$adv_result, &$adv_from, &$adv_query, &$order_query, &$filters));
     $query = "SELECT count(distinct prod.product_id) FROM `#__jshopping_products` AS prod\n                  LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n                  LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id                  \n                  {$adv_from}\n                  WHERE prod.product_publish = '1' AND cat.category_publish='1'\n                  {$adv_query}";
     $db->setQuery($query);
     $total = $db->loadResult();
     if (!$total) {
         $view_name = "search";
         $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
         $view = $this->getView($view_name, getDocumentType(), '', $view_config);
         $view->setLayout("noresult");
         $view->assign('search', $search);
         $view->display();
         return 0;
     }
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'search'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $query = "SELECT {$adv_result} FROM `#__jshopping_products` AS prod\n                  LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n                  LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id                  \n                  {$adv_from}\n                  WHERE prod.product_publish = '1' AND cat.category_publish='1'\n                  {$adv_query}\n                  GROUP BY prod.product_id " . $order_query;
     $db->setQuery($query, $limitstart, $limit);
     $rows = $db->loadObjectList();
     $rows = listProductUpdateData($rows);
     addLinkToProducts($rows, 0, 1);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
         $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
     }
     insertValueInArray($jshopConfig->count_products_to_page, $jshopConfig->count_product_select);
     foreach ($jshopConfig->count_product_select as $key => $value) {
         $product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value');
     }
     $sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order);
     $product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit);
     $_review = JSFactory::getTable('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "search";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("products");
     $view->assign('search', $search);
     $view->assign('total', $total);
     $view->assign('config', $jshopConfig);
     $view->assign('template_block_list_product', "list_products/list_products.php");
     $view->assign('template_block_form_filter', "list_products/form_filters.php");
     $view->assign('template_block_pagination', "list_products/block_pagination.php");
     $view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir);
     $view->assign('filter_show', 0);
     $view->assign('filter_show_category', 0);
     $view->assign('filter_show_manufacturer', 0);
     $view->assign('pagination', $pagenav);
     $view->assign('pagination_obj', $pagination);
     $view->assign('display_pagination', $pagenav != "");
     $view->assign('product_count', $product_count_sel);
     $view->assign('sorting', $sorting_sel);
     $view->assign('action', $action);
     $view->assign('orderby', $orderby);
     $view->assign('count_product_to_row', $jshopConfig->count_products_to_row);
     $view->assign('rows', $rows);
     $view->assign('allow_review', $allow_review);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Example #9
0
 function view()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $session = JFactory::getSession();
     $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $manufacturer_id = JRequest::getInt('manufacturer_id');
     $category_id = JRequest::getInt('category_id');
     $label_id = JRequest::getInt('label_id');
     $vendor_id = JRequest::getInt('vendor_id');
     $manufacturer = JTable::getInstance('manufacturer', 'jshop');
     $manufacturer->load($manufacturer_id);
     $manufacturer->getDescription();
     JPluginHelper::importPlugin('jshopping');
     $dispatcher->trigger('onBeforeDisplayManufacturer', array(&$manufacturer));
     if ($manufacturer->manufacturer_publish == 0) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if (getShopManufacturerPageItemid() == JRequest::getInt('Itemid')) {
         appendPathWay($manufacturer->name);
     }
     if ($manufacturer->meta_title == "") {
         $manufacturer->meta_title = $manufacturer->name;
     }
     setMetaData($manufacturer->meta_title, $manufacturer->meta_keyword, $manufacturer->meta_description);
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     if (!$manufacturer->products_page) {
         $manufacturer->products_page = $jshopConfig->count_products_to_page;
     }
     $count_product_to_row = $manufacturer->products_row;
     if (!$count_product_to_row) {
         $count_product_to_row = $jshopConfig->count_products_to_row;
     }
     $context = "jshoping.manufacturlist.front.product";
     $contextfilter = "jshoping.list.front.product.manf." . $manufacturer_id;
     $orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int');
     $order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int');
     $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $manufacturer->products_page, 'int');
     if (!$limit) {
         $limit = $manufacturer->products_page;
     }
     $limitstart = JRequest::getInt('limitstart');
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $field_order = $jshopConfig->sorting_products_field_s_select[$order];
     $filters = getBuildFilterListProduct($contextfilter, array("manufacturers"));
     $total = $manufacturer->getCountProducts($filters);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'manufacturer'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $rows = $manufacturer->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
     addLinkToProducts($rows, 0, 1);
     foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
         $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
     }
     insertValueInArray($manufacturer->products_page, $jshopConfig->count_product_select);
     //insert products_page count
     foreach ($jshopConfig->count_product_select as $key => $value) {
         $product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value');
     }
     $sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order);
     $product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit);
     $_review = JTable::getInstance('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     if ($jshopConfig->show_product_list_filters) {
         $filter_categorys = $manufacturer->getCategorys();
         $first_category = array();
         $first_category[] = JHTML::_('select.option', 0, _JSHOP_ALL, 'id', 'name');
         if (isset($filters['categorys'][0])) {
             $active_category = $filters['categorys'][0];
         } else {
             $active_category = 0;
         }
         $categorys_sel = JHTML::_('select.genericlist', array_merge($first_category, $filter_categorys), 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'id', 'name', $active_category);
     } else {
         $categorys_sel = '';
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($manufacturer, "manufacturer");
     }
     $display_list_products = count($rows) > 0 || willBeUseFilter($filters);
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "manufacturer";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("products");
     $view->assign('config', $jshopConfig);
     $view->assign('template_block_list_product', "list_products/list_products.php");
     $view->assign('template_block_form_filter', "list_products/form_filters.php");
     $view->assign('template_block_pagination', "list_products/block_pagination.php");
     $view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir);
     $view->assign('filter_show', 1);
     $view->assign('filter_show_category', 1);
     $view->assign('filter_show_manufacturer', 0);
     $view->assign('pagination', $pagenav);
     $view->assign('pagination_obj', $pagination);
     $view->assign('display_pagination', $pagenav != "");
     $view->assign("rows", $rows);
     $view->assign("count_product_to_row", $count_product_to_row);
     $view->assign("manufacturer", $manufacturer);
     $view->assign('action', $action);
     $view->assign('allow_review', $allow_review);
     $view->assign('orderby', $orderby);
     $view->assign('product_count', $product_count_sel);
     $view->assign('sorting', $sorting_sel);
     $view->assign('categorys_sel', $categorys_sel);
     $view->assign('filters', $filters);
     $view->assign('display_list_products', $display_list_products);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Example #10
0
 function display($cachable = false, $urlparams = false)
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ajax = JRequest::getInt('ajax');
     $jshopConfig = JSFactory::getConfig();
     $user = JFactory::getUser();
     JSFactory::loadJsFilesLightBox();
     $session = JFactory::getSession();
     $tmpl = JRequest::getVar("tmpl");
     if ($tmpl != "component") {
         $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     }
     $product_id = JRequest::getInt('product_id');
     $category_id = JRequest::getInt('category_id');
     $attr = JRequest::getVar("attr");
     $back_value = $session->get('product_back_value');
     if (!isset($back_value['pid'])) {
         $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
     }
     if ($back_value['pid'] != $product_id) {
         $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
     }
     if (!is_array($back_value['attr'])) {
         $back_value['attr'] = array();
     }
     if (count($back_value['attr']) == 0 && is_array($attr)) {
         $back_value['attr'] = $attr;
     }
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProduct', array(&$product_id, &$category_id, &$back_value));
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JTable::getInstance('product', 'jshop');
     $product->load($product_id);
     $listcategory = $product->getCategories(1);
     if (!getDisplayPriceForProduct($product->product_price)) {
         $jshopConfig->attr_display_addprice = 0;
     }
     $attributesDatas = $product->getAttributesDatas($back_value['attr']);
     $product->setAttributeActive($attributesDatas['attributeActive']);
     $attributeValues = $attributesDatas['attributeValues'];
     $attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
     if (count($attributes)) {
         $_attributevalue = JTable::getInstance('AttributValue', 'jshop');
         $all_attr_values = $_attributevalue->getAllAttributeValues();
     } else {
         $all_attr_values = array();
     }
     $session->set('product_back_value', array());
     $product->getExtendsData();
     $category = JTable::getInstance('category', 'jshop');
     $category->load($category_id);
     $category->name = $category->getName();
     $dispatcher->trigger('onBeforeCheckProductPublish', array(&$product, &$category, &$category_id, &$listcategory));
     if ($category->category_publish == 0 || $product->product_publish == 0 || !in_array($product->access, $user->getAuthorisedViewLevels()) || !in_array($category_id, $listcategory)) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
         appendExtendPathway($category->getTreeChild(), 'product');
     }
     appendPathWay($product->name);
     if ($product->meta_title == "") {
         $product->meta_title = $product->name;
     }
     setMetaData($product->meta_title, $product->meta_keyword, $product->meta_description);
     $product->hit();
     $product->product_basic_price_unit_qty = 1;
     if ($jshopConfig->admin_show_product_basic_price) {
         $product->getBasicPriceInfo();
     } else {
         $product->product_basic_price_show = 0;
     }
     $view_name = "product";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     if ($product->product_template == "") {
         $product->product_template = "default";
     }
     $view->setLayout("product_" . $product->product_template);
     $_review = JTable::getInstance('review', 'jshop');
     if (($allow_review = $_review->getAllowReview()) > 0) {
         $arr_marks = array();
         $arr_marks[] = JHTML::_('select.option', '0', _JSHOP_NOT, 'mark_id', 'mark_value');
         for ($i = 1; $i <= $jshopConfig->max_mark; $i++) {
             $arr_marks[] = JHTML::_('select.option', $i, $i, 'mark_id', 'mark_value');
         }
         $text_review = '';
         $select_review = JHTML::_('select.genericlist', $arr_marks, 'mark', 'class="inputbox" size="1"', 'mark_id', 'mark_value');
     } else {
         $select_review = '';
         $text_review = $_review->getText();
     }
     if ($allow_review) {
         JSFactory::loadJsFilesRating();
     }
     if ($jshopConfig->product_show_manufacturer_logo || $jshopConfig->product_show_manufacturer) {
         $product->manufacturer_info = $product->getManufacturerInfo();
         if (!isset($product->manufacturer_info)) {
             $product->manufacturer_info = new stdClass();
             $product->manufacturer_info->manufacturer_logo = '';
             $product->manufacturer_info->name = '';
         }
     } else {
         $product->manufacturer_info = new stdClass();
         $product->manufacturer_info->manufacturer_logo = '';
         $product->manufacturer_info->name = '';
     }
     if ($jshopConfig->product_show_vendor) {
         $vendorinfo = $product->getVendorInfo();
         $vendorinfo->urllistproducts = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendorinfo->id, 1);
         $vendorinfo->urlinfo = SEFLink("index.php?option=com_jshopping&controller=vendor&task=info&vendor_id=" . $vendorinfo->id, 1);
         $product->vendor_info = $vendorinfo;
     } else {
         $product->vendor_info = null;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         $product->extra_field = $product->getExtraFields();
     } else {
         $product->extra_field = null;
     }
     if ($jshopConfig->admin_show_freeattributes) {
         $product->getListFreeAttributes();
         foreach ($product->freeattributes as $k => $v) {
             if (!isset($back_value['freeattr'][$v->id])) {
                 $back_value['freeattr'][$v->id] = '';
             }
             $product->freeattributes[$k]->input_field = '<input type="text" class="inputbox" size="40" name="freeattribut[' . $v->id . ']" value="' . $back_value['freeattr'][$v->id] . '" />';
         }
         $attrrequire = $product->getRequireFreeAttribute();
         $product->freeattribrequire = count($attrrequire);
     } else {
         $product->freeattributes = null;
         $product->freeattribrequire = 0;
     }
     if ($jshopConfig->product_show_qty_stock) {
         $product->qty_in_stock = getDataProductQtyInStock($product);
     }
     if (!$jshopConfig->admin_show_product_labels) {
         $product->label_id = null;
     }
     if ($product->label_id) {
         $image = getNameImageLabel($product->label_id);
         if ($image) {
             $product->_label_image = $jshopConfig->image_labels_live_path . "/" . $image;
         }
         $product->_label_name = getNameImageLabel($product->label_id, 2);
     }
     $hide_buy = 0;
     if ($jshopConfig->user_as_catalog) {
         $hide_buy = 1;
     }
     if ($jshopConfig->hide_buy_not_avaible_stock && $product->product_quantity <= 0) {
         $hide_buy = 1;
     }
     $available = "";
     if ($product->getQty() <= 0 && $product->product_quantity > 0) {
         $available = _JSHOP_PRODUCT_NOT_AVAILABLE_THIS_OPTION;
     } elseif ($product->product_quantity <= 0) {
         $available = _JSHOP_PRODUCT_NOT_AVAILABLE;
     }
     $product->_display_price = getDisplayPriceForProduct($product->getPriceCalculate());
     if (!$product->_display_price) {
         $product->product_old_price = 0;
         $product->product_price_default = 0;
         $product->product_basic_price_show = 0;
         $product->product_is_add_price = 0;
         $product->product_tax = 0;
         $jshopConfig->show_plus_shipping_in_product = 0;
     }
     if (!$product->_display_price) {
         $hide_buy = 1;
     }
     $default_count_product = 1;
     if ($jshopConfig->min_count_order_one_product > 1) {
         $default_count_product = $jshopConfig->min_count_order_one_product;
     }
     if ($back_value['qty']) {
         $default_count_product = $back_value['qty'];
     }
     if (trim($product->description) == "") {
         $product->description = $product->short_description;
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($product, "product");
     }
     $product->button_back_js_click = "history.go(-1);";
     if ($session->get('jshop_end_page_list_product') && $jshopConfig->product_button_back_use_end_list) {
         $product->button_back_js_click = "location.href='" . $session->get('jshop_end_page_list_product') . "';";
     }
     $displaybuttons = '';
     if ($jshopConfig->hide_buy_not_avaible_stock && $product->getQty() <= 0) {
         $displaybuttons = 'display:none;';
     }
     $product_images = $product->getImages();
     $product_videos = $product->getVideos();
     $product_demofiles = $product->getDemoFiles();
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$product->product_related));
     $dispatcher->trigger('onBeforeDisplayProduct', array(&$product, &$view, &$product_images, &$product_videos, &$product_demofiles));
     $view->assign('config', $jshopConfig);
     $view->assign('image_path', $jshopConfig->live_path . '/images');
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('image_product_path', $jshopConfig->image_product_live_path);
     $view->assign('video_product_path', $jshopConfig->video_product_live_path);
     $view->assign('video_image_preview_path', $jshopConfig->video_product_live_path);
     $view->assign('product', $product);
     $view->assign('category_id', $category_id);
     $view->assign('images', $product_images);
     $view->assign('videos', $product_videos);
     $view->assign('demofiles', $product_demofiles);
     $view->assign('attributes', $attributes);
     $view->assign('all_attr_values', $all_attr_values);
     $view->assign('related_prod', $product->product_related);
     $view->assign('path_to_image', $jshopConfig->live_path . 'images/');
     $view->assign('live_path', JURI::root());
     $view->assign('enable_wishlist', $jshopConfig->enable_wishlist);
     $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=cart&task=add', 1));
     $view->assign('urlupdateprice', SEFLink('index.php?option=com_jshopping&controller=product&task=ajax_attrib_select_and_price&product_id=' . $product_id . '&ajax=1', 1, 1));
     if ($allow_review) {
         $context = "jshoping.list.front.product.review";
         $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', 20, 'int');
         $limitstart = JRequest::getInt('limitstart');
         $total = $product->getReviewsCount();
         $view->assign('reviews', $product->getReviews($limitstart, $limit));
         jimport('joomla.html.pagination');
         $pagination = new JPagination($total, $limitstart, $limit);
         $pagenav = $pagination->getPagesLinks();
         $view->assign('pagination', $pagenav);
         $view->assign('pagination_obj', $pagination);
         $view->assign('display_pagination', $pagenav != "");
     }
     $view->assign('allow_review', $allow_review);
     $view->assign('select_review', $select_review);
     $view->assign('text_review', $text_review);
     $view->assign('stars_count', floor($jshopConfig->max_mark / $jshopConfig->rating_starparts));
     $view->assign('parts_count', $jshopConfig->rating_starparts);
     $view->assign('user', $user);
     $view->assign('shippinginfo', SEFLink('index.php?option=com_jshopping&controller=content&task=view&page=shipping', 1));
     $view->assign('hide_buy', $hide_buy);
     $view->assign('available', $available);
     $view->assign('default_count_product', $default_count_product);
     $view->assign('folder_list_products', "list_products");
     $view->assign('back_value', $back_value);
     $view->assign('displaybuttons', $displaybuttons);
     $dispatcher->trigger('onBeforeDisplayProductView', array(&$view));
     $view->display();
     $dispatcher->trigger('onAfterDisplayProduct', array(&$product));
     if ($ajax) {
         die;
     }
 }
Example #11
0
 public static function product($category, $product)
 {
     $Itemid = JRequest::getInt('Itemid');
     if (getShopMainPageItemid() == $Itemid) {
         appendExtendPathway($category->getTreeChild(), 'product');
     }
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $menuItem = $menu->getItem($Itemid);
     if ($menuItem->query['view'] != 'product') {
         appendPathWay($product->name);
     }
     if ($product->meta_title == "") {
         $product->meta_title = $product->name;
     }
     setMetaData($product->meta_title, $product->meta_keyword, $product->meta_description);
 }
Example #12
0
 function finish(){
     $this->_check(10);
     
     $jshopConfig = &JSFactory::getConfig();
     $db = &JFactory::getDBO();
     
     $document =& JFactory::getDocument();
     $document->setTitle(_JSHOP_CHECKOUT_FINISH);            
     appendPathWay(_JSHOP_CHECKOUT_FINISH);
     
     $statictext = &JTable::getInstance("statictext","jshop");
     $rowstatictext = $statictext->loadData("order_finish_descr");        
     $text = $rowstatictext->text;
     
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher =& JDispatcher::getInstance();
     $dispatcher->trigger( 'onBeforeDisplayCheckoutFinish', array(&$text) );
     
     if (trim(strip_tags($text)) == ""){        
         $view_name = "checkout";
         $view_config = array("template_path"=>JPATH_COMPONENT."/templates/".$jshopConfig->template."/".$view_name);
         $view = &$this->getView($view_name, 'html', '', $view_config);
         $view->setLayout("finish");        
         $view->display();
     }else{
         print $text;
     }
     
     //clear all info order
     $cart = &JModel::getInstance('cart', 'jshop');
     $cart->load();                
     $cart->getSum();
     $cart->clear();
     $this->_deleteSession();    
 }
Example #13
0
 public static function product($category, $product)
 {
     if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
         appendExtendPathway($category->getTreeChild(), 'product');
     }
     appendPathWay($product->name);
     if ($product->meta_title == "") {
         $product->meta_title = $product->name;
     }
     setMetaData($product->meta_title, $product->meta_keyword, $product->meta_description);
 }