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; } }
function register() { $jshopConfig = JSFactory::getConfig(); $db = JFactory::getDBO(); $mainframe = JFactory::getApplication(); $params = $mainframe->getParams(); $seo = JTable::getInstance("seo", "jshop"); $seodata = $seo->loadData("register"); if (getThisURLMainPageShop()) { appendPathWay(_JSHOP_REGISTRATION); if ($seodata->title == "") { $seodata->title = _JSHOP_REGISTRATION; } setMetaData($seodata->title, $seodata->keyword, $seodata->description); } else { setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params); } $usersConfig = JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { JError::raiseError(403, JText::_('Access Forbidden')); return; } $country = JTable::getInstance('country', 'jshop'); $list_country = $country->getAllCountries(); $option_country[] = JHTML::_('select.option', '0', _JSHOP_REG_SELECT, 'country_id', 'name'); $select_countries = JHTML::_('select.genericlist', array_merge($option_country, $list_country), 'country', 'id = "country" class = "inputbox" size = "1"', 'country_id', 'name', $jshopConfig->default_country); foreach ($jshopConfig->user_field_title as $key => $value) { $option_title[] = JHTML::_('select.option', $key, $value, 'title_id', 'title_name'); } $select_titles = JHTML::_('select.genericlist', $option_title, 'title', 'class = "inputbox"', 'title_id', 'title_name'); $client_types = array(); foreach ($jshopConfig->user_field_client_type as $key => $value) { $client_types[] = JHTML::_('select.option', $key, $value, 'id', 'name'); } $select_client_types = JHTML::_('select.genericlist', $client_types, 'client_type', 'class = "inputbox" onchange="showHideFieldFirm(this.value)"', 'id', 'name'); $tmp_fields = $jshopConfig->getListFieldsRegister(); $config_fields = $tmp_fields['register']; JPluginHelper::importPlugin('jshoppingcheckout'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeDisplayRegister', array()); if ($config_fields['birthday']['display']) { JHTML::_('behavior.calendar'); } $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("register"); $view->assign('config', $jshopConfig); $view->assign('select_client_types', $select_client_types); $view->assign('select_titles', $select_titles); $view->assign('select_countries', $select_countries); $view->assign('config_fields', $config_fields); $view->assign('live_path', JURI::base()); $view->assign('urlcheckdata', SEFLink("index.php?option=com_jshopping&controller=user&task=check_user_exist_ajax&ajax=1", 1, 1)); $dispatcher->trigger('onBeforeDisplayRegisterView', array(&$view)); $view->display(); }
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; } }
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(); }
public static function wishlist() { $params = JFactory::getApplication()->getParams(); $seo = JSFactory::getTable("seo", "jshop"); $seodata = $seo->loadData("wishlist"); if (getThisURLMainPageShop()) { 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); } }