Beispiel #1
0
 function setUpRestIOA()
 {
     /**
      * Setup Header Data
      */
     $header_data = "W1t7Im5hbWUiOiJUYWdsaW5lPGEgaHJlZj1cXFwiXFxcIiBjbGFzcz1cXFwiaGNvbi1lZGl0IGVudHlwbyBwZW5jaWxcXFwiPjxcL2E+IiwidmFsdWUiOiJ0YWdsaW5lIiwiYWxpZ24iOiJkZWZhdWx0IiwibWFyZ2luIjoiMDowOjA6MCJ9XSxbeyJjb250YWluZXIiOiJ0b3AtYXJlYSIsImV5ZSI6Im9uIiwicG9zaXRpb24iOiJzdGF0aWMiLCJoZWlnaHQiOiIwIiwiZGF0YSI6W3siYWxpZ24iOiJsZWZ0IiwiZWxlbWVudHMiOlt7InZhbCI6IndwbWwiLCJhbGlnbiI6ImRlZmF1bHQiLCJ0ZXh0IjoiIiwibWFyZ2luIjoiMDowOjA6MCIsIm5hbWUiOiJXUE1MIFNlbGVjdG9yIn0seyJ2YWwiOiJzb2NpYWwiLCJhbGlnbiI6ImRlZmF1bHQiLCJ0ZXh0IjoidHdpdHRlcjx2Yz5odHRwczpcL1wvdHdpdHRlci5jb21cL2FydGlsbGVnZW5jZTxzYz5mYWNlYm9vazx2Yz5odHRwczpcL1wvd3d3LmZhY2Vib29rLmNvbVwvYXJ0aWxsZWdlbmNlPHNjPmZsaWNrcjx2Yz5odHRwOlwvXC9mbGlja3IuY29tXC88c2M+dmltZW88dmM+aHR0cHM6XC9cL3ZpbWVvLmNvbVwvdXNlcjIwMDIyMDg5PHNjPnBpbnRlcmVzdDx2Yz5odHRwczpcL1wvcGludGVyZXN0LmNvbVwvPHNjPmRyaWJiYmxlPHZjPmh0dHA6XC9cL2RyaWJiYmxlLmNvbVwvYXJ0aWxsZWdlbmNlPHNjPnNreXBlPHZjPmNhbGw6YWJoaW4uc2hhcm1hPHNjPiIsIm1hcmdpbiI6IjA6MDowOjAiLCJuYW1lIjoiU29jaWFsIEljb25zIn0seyJ2YWwiOiJ0ZXh0IiwiYWxpZ24iOiJkZWZhdWx0IiwidGV4dCI6IkhlbHBsaW5lICsxIDM0MzMzMzMzMyIsIm1hcmdpbiI6IjEwOjA6MDoxNyIsIm5hbWUiOiJUZXh0ICJ9XX0seyJhbGlnbiI6ImNlbnRlciJ9LHsiYWxpZ24iOiJyaWdodCIsImVsZW1lbnRzIjpbeyJ2YWwiOiJ0b3AtbWVudSIsImFsaWduIjoiZGVmYXVsdCIsInRleHQiOiIwIiwibWFyZ2luIjoiMDowOjA6MCIsIm5hbWUiOiJNZW51IDIifV19XX0seyJjb250YWluZXIiOiJtZW51LWFyZWEiLCJleWUiOiJvbiIsInBvc2l0aW9uIjoic3RhdGljIiwiaGVpZ2h0IjoiMCIsImRhdGEiOlt7ImFsaWduIjoibGVmdCIsImVsZW1lbnRzIjpbeyJ2YWwiOiJsb2dvIiwiYWxpZ24iOiJkZWZhdWx0IiwidGV4dCI6IjAiLCJtYXJnaW4iOiIwOjA6MDowIiwibmFtZSI6IkxvZ28ifV19LHsiYWxpZ24iOiJjZW50ZXIifSx7ImFsaWduIjoicmlnaHQiLCJlbGVtZW50cyI6W3sidmFsIjoic2VhcmNoIiwiYWxpZ24iOiJkZWZhdWx0IiwidGV4dCI6IjAiLCJtYXJnaW4iOiI2OjA6MDowIiwibmFtZSI6IlNlYXJjaCBCYXIifSx7InZhbCI6Im1haW4tbWVudSIsImFsaWduIjoiZGVmYXVsdCIsInRleHQiOiIwIiwibWFyZ2luIjoiMDowOjA6MCIsIm5hbWUiOiJNZW51IDEifV19XX0seyJjb250YWluZXIiOiJ0b3AtZnVsbC1hcmVhIiwiZXllIjoib2ZmIiwicG9zaXRpb24iOiJzdGF0aWMiLCJoZWlnaHQiOiIiLCJkYXRhIjpbeyJhbGlnbiI6ImxlZnQifSx7ImFsaWduIjoiY2VudGVyIn0seyJhbGlnbiI6InJpZ2h0In1dfV1d";
     $header_data = base64_decode($header_data);
     $header_data = json_decode($header_data, true);
     update_option(SN . '_header_construction_data', $header_data);
     update_option(SN . 'font_selector', 'google');
     update_option(SN . 'font_stacks', array('Raleway;;'));
     $images = get_option('ioa_demo_images');
     setMenus();
     setMetaData();
     setWidgets();
     setShopData();
     $page = get_page_by_title('Home');
     update_option('page_on_front', $page->ID);
     update_option('show_on_front', 'page');
     if (function_exists('rev_slider_shortcode')) {
         require_once HPATH . "/installer/rev_import_class.php";
         $c = new CustomREVInstaller();
         $c->importREVSliderFromPost(HPATH . '/installer/slider_export.txt');
         $c->importREVSliderFromPost(HPATH . '/installer/slider_export_1.txt');
         $c->importREVSliderFromPost(HPATH . '/installer/slider_export_2.txt');
     }
 }
 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;
     }
 }
Beispiel #3
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;
 }
Beispiel #4
0
 function groupsinfo()
 {
     $jshopConfig = JSFactory::getConfig();
     setMetaData(_JSHOP_USER_GROUPS_INFO, "", "");
     $group = JTable::getInstance('userGroup', 'jshop');
     $list = $group->getList();
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayGroupsInfo', array());
     $view_name = "user";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     $view->setLayout("groupsinfo");
     $view->assign('rows', $list);
     $dispatcher->trigger('onBeforeDisplayGroupsInfoView', array(&$view));
     $view->display();
 }
 function step5()
 {
     $checkout = JModelLegacy::getInstance('checkout', 'jshop');
     $checkout->checkStep(5);
     JPluginHelper::importPlugin('jshoppingcheckout');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onLoadCheckoutStep5', array());
     appendPathWay(_JSHOP_CHECKOUT_PREVIEW);
     $seo = JTable::getInstance("seo", "jshop");
     $seodata = $seo->loadData("checkout-preview");
     if ($seodata->title == "") {
         $seodata->title = _JSHOP_CHECKOUT_PREVIEW;
     }
     setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     $cart = JModelLegacy::getInstance('cart', 'jshop');
     $cart->load();
     $session = JFactory::getSession();
     $jshopConfig = JSFactory::getConfig();
     $user = JFactory::getUser();
     if ($user->id) {
         $adv_user = JSFactory::getUserShop();
     } else {
         $adv_user = JSFactory::getUserShopGuest();
     }
     $sh_method = JTable::getInstance('shippingMethod', 'jshop');
     $shipping_method_id = $cart->getShippingId();
     $sh_method->load($shipping_method_id);
     $sh_mt_pr = JTable::getInstance('shippingMethodPrice', 'jshop');
     $sh_mt_pr->load($cart->getShippingPrId());
     if ($jshopConfig->show_delivery_time_checkout) {
         $deliverytimes = JSFactory::getAllDeliveryTime();
         $deliverytimes[0] = '';
         $delivery_time = $deliverytimes[$sh_mt_pr->delivery_times_id];
         if (!$delivery_time && $jshopConfig->delivery_order_depends_delivery_product) {
             $delivery_time = $cart->getDelivery();
         }
     } else {
         $delivery_time = '';
     }
     if ($jshopConfig->show_delivery_date) {
         $delivery_date = $cart->getDeliveryDate();
         if ($delivery_date) {
             $delivery_date = formatdate($cart->getDeliveryDate());
         }
     } else {
         $delivery_date = '';
     }
     $pm_method = JTable::getInstance('paymentMethod', 'jshop');
     $payment_method_id = $cart->getPaymentId();
     $pm_method->load($payment_method_id);
     $lang = JSFactory::getLang();
     $field_country_name = $lang->get("name");
     $invoice_info = array();
     $country = JTable::getInstance('country', 'jshop');
     $country->load($adv_user->country);
     $invoice_info['f_name'] = $adv_user->f_name;
     $invoice_info['l_name'] = $adv_user->l_name;
     $invoice_info['firma_name'] = $adv_user->firma_name;
     $invoice_info['street'] = $adv_user->street;
     $invoice_info['zip'] = $adv_user->zip;
     $invoice_info['state'] = $adv_user->state;
     $invoice_info['city'] = $adv_user->city;
     $invoice_info['country'] = $country->{$field_country_name};
     $invoice_info['home'] = $adv_user->home;
     $invoice_info['apartment'] = $adv_user->apartment;
     if ($adv_user->delivery_adress) {
         $country = JTable::getInstance('country', 'jshop');
         $country->load($adv_user->d_country);
         $delivery_info['f_name'] = $adv_user->d_f_name;
         $delivery_info['l_name'] = $adv_user->d_l_name;
         $delivery_info['firma_name'] = $adv_user->d_firma_name;
         $delivery_info['street'] = $adv_user->d_street;
         $delivery_info['zip'] = $adv_user->d_zip;
         $delivery_info['state'] = $adv_user->d_state;
         $delivery_info['city'] = $adv_user->d_city;
         $delivery_info['country'] = $country->{$field_country_name};
         $delivery_info['home'] = $adv_user->d_home;
         $delivery_info['apartment'] = $adv_user->d_apartment;
     } else {
         $delivery_info = $invoice_info;
     }
     $tmp_fields = $jshopConfig->getListFieldsRegister();
     $config_fields = $tmp_fields['address'];
     $count_filed_delivery = $jshopConfig->getEnableDeliveryFiledRegistration('address');
     $checkout_navigator = $this->_showCheckoutNavigation(5);
     $small_cart = $this->_showSmallCart(5);
     $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("previewfinish");
     $dispatcher->trigger('onBeforeDisplayCheckoutStep5', array(&$sh_method, &$pm_method, &$delivery_info, &$cart, &$view));
     $lang = JSFactory::getLang();
     $name = $lang->get("name");
     $sh_method->name = $sh_method->{$name};
     $view->assign('sh_method', $sh_method);
     $view->assign('payment_name', $pm_method->{$name});
     $view->assign('delivery_info', $delivery_info);
     $view->assign('invoice_info', $invoice_info);
     $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5save', 0, 0, $jshopConfig->use_ssl));
     $view->assign('config', $jshopConfig);
     $view->assign('delivery_time', $delivery_time);
     $view->assign('delivery_date', $delivery_date);
     $view->assign('checkout_navigator', $checkout_navigator);
     $view->assign('small_cart', $small_cart);
     $view->assign('count_filed_delivery', $count_filed_delivery);
     $dispatcher->trigger('onBeforeDisplayCheckoutStep5View', array(&$view));
     $view->display();
 }
Beispiel #6
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();
 }
Beispiel #7
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;
     }
 }
Beispiel #8
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();
 }
Beispiel #9
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();
 }
Beispiel #10
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();
 }
 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;
     }
 }
 function last()
 {
     $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());
     $product = JSFactory::getTable('product', 'jshop');
     $params = $mainframe->getParams();
     $header = getPageHeaderOfParams($params);
     $prefix = $params->get('pageclass_sfx');
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("lastproducts");
     setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     $count_product_to_row = $jshopConfig->count_products_to_row_last;
     $contextfilter = "jshoping.list.front.product.last";
     $filters = getBuildFilterListProduct($contextfilter, array());
     $rows = $product->getLastProducts($jshopConfig->count_products_to_page_last, null, $filters);
     addLinkToProducts($rows, 0, 1);
     $_review = JSFactory::getTable('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     $display_list_products = count($rows) > 0;
     $jshopConfig->show_sort_product = 0;
     $jshopConfig->show_count_select_products = 0;
     $jshopConfig->show_product_list_filters = 0;
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "products";
     $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_block_form_filter', "list_products/form_filters.php");
     $view->assign('template_block_pagination', "list_products/block_pagination.php");
     $view->assign("header", $header);
     $view->assign("prefix", $prefix);
     $view->assign("rows", $rows);
     $view->assign("count_product_to_row", $count_product_to_row);
     $view->assign('allow_review', $allow_review);
     $view->assign('display_list_products', $display_list_products);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Beispiel #13
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);
 }
Beispiel #14
0
    function step5(){
        
        $this->_check(5);
            
        appendPathWay(_JSHOP_CHECKOUT_PREVIEW);
        $seo = &JTable::getInstance("seo", "jshop");
        $seodata = $seo->loadData("checkout-preview");
        if ($seodata->title==""){
            $seodata->title = _JSHOP_CHECKOUT_PREVIEW;
        }
        setMetaData($seodata->title, $seodata->keyword, $seodata->description);
        
        $this->_showCheckoutNavigation(5);
        
        $cart = &JModel::getInstance('cart', 'jshop');
        $cart->load();              
        
        $session =& JFactory::getSession();        
        $jshopConfig = &JSFactory::getConfig(); 
        $user = &JFactory::getUser();
        if ($user->id){
            $adv_user = &JSFactory::getUserShop();
        }else{
            $adv_user = &JSFactory::getUserShopGuest();    
        }
        
        $this->_showSmallCart(5);
                
        $sh_method = &JTable::getInstance('shippingMethod', 'jshop');
        $shipping_method_id = $cart->getShippingId();
        $sh_method->load($shipping_method_id);
        
        $pm_method = &JTable::getInstance('paymentMethod', 'jshop');
        $payment_method_id = $cart->getPaymentId();
		$pm_method->load($payment_method_id);        
				
        $lang = &JSFactory::getLang();
        
		if ($adv_user->delivery_adress){
            $country = &JTable::getInstance('country', 'jshop');
            $country->load($adv_user->d_country);
            
			$delivery_info['f_name'] = $adv_user->d_f_name;
            $delivery_info['l_name'] = $adv_user->d_l_name;
			$delivery_info['firma_name'] = $adv_user->d_firma_name;
			$delivery_info['street'] = $adv_user->d_street;
			$delivery_info['zip'] = $adv_user->d_zip;
			$delivery_info['state'] = $adv_user->d_state;
            $delivery_info['city'] = $adv_user->d_city;
            $field_country_name = $lang->get("name");
			$delivery_info['country'] = $country->$field_country_name;
		} else {
            $country = &JTable::getInstance('country', 'jshop');
            $country->load($adv_user->country);
            
			$delivery_info['f_name'] = $adv_user->f_name;
			$delivery_info['l_name'] = $adv_user->l_name;
            $delivery_info['firma_name'] = $adv_user->firma_name;
			$delivery_info['street'] = $adv_user->street;
			$delivery_info['zip'] = $adv_user->zip;
			$delivery_info['state'] = $adv_user->state;
            $delivery_info['city'] = $adv_user->city;
            $field_country_name = $lang->get("name");
			$delivery_info['country'] = $country->$field_country_name;
		}
        
        JPluginHelper::importPlugin('jshoppingcheckout');
        $dispatcher =& JDispatcher::getInstance();
        $dispatcher->trigger( 'onBeforeDisplayCheckoutStep5', array(&$sh_method, &$pm_method, &$delivery_info) );
		
		$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("previewfinish");        
                
        $lang = &JSFactory::getLang();
        $name = $lang->get("name");
        $sh_method->name = $sh_method->$name;
		$view->assign('sh_method', $sh_method );    
		$view->assign('payment_name', $pm_method->$name);
		$view->assign('delivery_info', $delivery_info);
        $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5save',0,0, $jshopConfig->use_ssl));       
		$view->assign('config', $jshopConfig);
        
    	$view->display();
    }
 function view()
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $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());
     $category_id = JRequest::getInt('category_id');
     $category = JSFactory::getTable('category', 'jshop');
     $category->load($category_id);
     $category->getDescription();
     $dispatcher->trigger('onAfterLoadCategory', array(&$category, &$user));
     if (!$category->category_id || $category->category_publish == 0 || !in_array($category->access, $user->getAuthorisedViewLevels())) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     $manufacturer_id = JRequest::getInt('manufacturer_id');
     $label_id = JRequest::getInt('label_id');
     $vendor_id = JRequest::getInt('vendor_id');
     $view_name = "category";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     if ($category->category_template == "") {
         $category->category_template = "default";
     }
     $view->setLayout("category_" . $category->category_template);
     $jshopConfig->count_products_to_page = $category->products_page;
     $context = "jshoping.list.front.product";
     $contextfilter = "jshoping.list.front.product.cat." . $category_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', $category->products_page, 'int');
     if (!$limit) {
         $limit = $category->products_page;
     }
     $limitstart = JRequest::getInt('limitstart');
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $field_order = $jshopConfig->sorting_products_field_select[$order];
     $filters = getBuildFilterListProduct($contextfilter, array("categorys"));
     if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
         appendExtendPathWay($category->getTreeChild(), 'category');
     }
     $orderfield = $jshopConfig->category_sorting == 1 ? "ordering" : "name";
     $sub_categories = $category->getChildCategories($orderfield, 'asc', $publish = 1);
     $dispatcher->trigger('onBeforeDisplayCategory', array(&$category, &$sub_categories));
     if ($category->meta_title == "") {
         $category->meta_title = $category->name;
     }
     setMetaData($category->meta_title, $category->meta_keyword, $category->meta_description);
     $total = $category->getCountProducts($filters);
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'category'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $products = $category->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
     addLinkToProducts($products, $category_id);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     foreach ($jshopConfig->sorting_products_name_select as $key => $value) {
         $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
     }
     insertValueInArray($category->products_page, $jshopConfig->count_product_select);
     //insert category 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 = JSFactory::getTable('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     if (!$category->category_ordertype) {
         $category->category_ordertype = 1;
     }
     $manufacuturers_sel = '';
     if ($jshopConfig->show_product_list_filters) {
         $filter_manufactures = $category->getManufacturers();
         $first_manufacturer = array();
         $first_manufacturer[] = JHTML::_('select.option', 0, _JSHOP_ALL, 'id', 'name');
         $manufacuturers_sel = JHTML::_('select.genericlist', array_merge($first_manufacturer, $filter_manufactures), 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'id', 'name', $filters['manufacturers'][0]);
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($category, "category");
     }
     $willBeUseFilter = willBeUseFilter($filters);
     $display_list_products = count($products) > 0 || $willBeUseFilter;
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$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', 0);
     $view->assign('filter_show_manufacturer', 1);
     $view->assign('pagination', $pagenav);
     $view->assign('pagination_obj', $pagination);
     $view->assign('display_pagination', $pagenav != "");
     $view->assign('rows', $products);
     $view->assign('count_product_to_row', $category->products_row);
     $view->assign('image_category_path', $jshopConfig->image_category_live_path);
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('category', $category);
     $view->assign('categories', $sub_categories);
     $view->assign('count_category_to_row', $jshopConfig->count_category_to_row);
     $view->assign('allow_review', $allow_review);
     $view->assign('product_count', $product_count_sel);
     $view->assign('sorting', $sorting_sel);
     $view->assign('action', $action);
     $view->assign('orderby', $orderby);
     $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();
 }
Beispiel #16
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);
 }