Beispiel #1
0
 public function initContent($token = null)
 {
     $app = JFactory::getApplication();
     $context = JeproshopContext::getContext();
     $task = $app->input->get('task');
     $view = $app->input->get('view');
     //$viewClass = $this->getView($view, JFactory::getDocument()->getType());
     if ($task == 'add' || $task == 'edit') {
         if ($task == 'add') {
         } elseif ($task == 'edit') {
         }
     } else {
         if ($category_id = (int) $this->current_category_id) {
             self::$_current_index .= '&category_id=' . (int) $this->current_category_id;
         }
         if (!$category_id) {
             $this->_defaultOrderBy = 'product';
             if (isset($context->cookie->product_order_by) && $context->cookie->product_order_by == 'position') {
                 unset($context->cookie->product_order_by);
                 unset($context->cookie->product_order_way);
             }
             //$category_id = 1;
         }
     }
     parent::initContent();
 }
Beispiel #2
0
 public function initialize()
 {
     parent::initialize();
     // Check if we can add a customer
     if (JeproshopShopModelShop::isFeaturePublished() && (JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_ALL || JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_GROUP)) {
         $this->can_add_customer = false;
     }
 }
Beispiel #3
0
 public function initialize()
 {
     parent::initialize();
     $app = JFactory::getApplication();
     $context = JeproshopContext::getContext();
     // Get address ID
     $address_id = 0;
     $type = $app->input->get('type');
     if ($this->use_ajax && isset($type)) {
         if ($type == 'delivery' && isset($context->cart->address_delivery_id)) {
             $address_id = (int) $context->cart->address_delivery_id;
         } else {
             if ($type == 'invoice' && isset($context->cart->address_invoice_id) && $context->cart->id_address_invoice != $context->cart->address_delivery_id) {
                 $address_id = (int) $context->cart->address_invoice_id;
             }
         }
     } else {
         $address_id = (int) $app->input->get('address_id', 0);
     }
     // Initialize address
     if ($address_id) {
         $address = new JeproshopAddressModelAddress($address_id);
         $view = $app->input->get('view');
         $viewClass = $this->getView($view, JFactory::getDocument()->getType());
         if (JeproshopTools::isLoadedObject($address, 'address_id') && JeproshopCustomerModelCustomer::customerHasAddress($context->customer->customer_id, $address_id)) {
             $task = $app->input->get('task');
             if (isset($task) && $task == 'delete') {
                 if ($address->delete()) {
                     if ($context->cart->address_invoice_id == $address->address_id) {
                         unset($context->cart->address_invoice_id);
                     }
                     if ($context->cart->id_address_delivery == $address->address_id) {
                         unset($context->cart->id_address_delivery);
                         $context->cart->updateAddressId($address->address_id, (int) JeproshopAddressModelAddress::getCustomerFirstAddressId($context->customer->customer_id));
                     }
                     $app->redirect('index.php?option=com_jeproshop&view=address');
                 }
                 $this->has_errors = true;
                 JError::raiseError(500, 'This address cannot be deleted.');
             }
         } elseif ($this->use_ajax) {
             $app->close;
         } else {
             $app->redirect('index.php?option=com_jeproshop&view=address');
         }
     }
 }
Beispiel #4
0
 public function initialize()
 {
     $app = JFactory::getApplication();
     $context = JeproshopContext::getContext();
     parent::initialize();
     $category_id = $app->input->get('category_id');
     $task = $app->input->get('task');
     if ($category_id && $task != 'delete') {
         $this->category = new JeproshopCategoryModelCategory($category_id);
     } else {
         if (JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP) {
             $this->category = new JeproshopCategoryModelCategory($context->shop->category_id);
         } elseif (count(JeproshopCategoryModelCategory::getCategoriesWithoutParent()) > 1 && JeproshopSettingModelSetting::getValue('multishop_feature_active') && count(JeproshopShopModelShop::getShops(true, null, true)) != 1) {
             $this->category = JeproshopCategoryModelCategory::getTopCategory();
         } else {
             $this->category = new JeproshopCategoryModelCategory(JeproshopSettingModelSetting::getValue('root_category'));
         }
     }
     if (JeproshopTools::isLoadedObject($this->category, 'category_id') && !$this->category->isAssociatedToShop() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP) {
         $app->redirect('index.php?option=com_jeproshop&view=category&task=edit&category_id=' . (int) $context->shop->getCategoryId() . '&' . JeproshopTools::getCategoryToken() . '=1');
     }
 }
Beispiel #5
0
 public function display($cachable = FALSE, $urlParams = FALSE)
 {
     parent::display();
 }
Beispiel #6
0
 /**
      * Check if order is free
      * @return boolean
      * /
     public function checkFreeOrder(){
         $context = JeproshopContext::getContext();
         if ($context->cart->getOrderTotal() <= 0) {
             $order = new JeproshopFreeOrderModelFreeOrder();
             $order->free_order_class = true;
             $order->validateOrder($context->cart->cart_id, Configuration::get('PS_OS_PAYMENT'), 0, Tools::displayError('Free order', false), null, array(), null, false, $context->cart->secure_key);
             return (int)JeproshopOrderModelOrder::getOrderByCartId($context->cart->cart_id);
         }
         return false;
     }
 
 
     public function assignCarrier(){
         $view = JFactory::getDBO();
         $context = JeproshopContext::getContext();
         $address = new JeproshopAddressModelAddress($context->cart->address_delivery_id);
         $zone_id = JeproshopAddressModelAddress::getZoneIdByAddressId($address->address_id);
         $carriers = $context->cart->simulateCarriersOutput(null, true);
         $checked = $context->cart->simulateCarrierSelectedOutput(false);
         $delivery_option_list = $context->cart->getDeliveryOptionList();
         $delivery_option = $context->cart->getDeliveryOption(null, false);
         $this->setDefaultCarrierSelection($delivery_option_list);
 
         $view->assignRef('address_collection', $context->cart->getAddressCollection());
         $view->assignRef('delivery_option_list', $delivery_option_list);
         $view->assignRef('carriers', $carriers);
         $view->assignRef('checked',  $checked);
         $view->assignRef('delivery_option', $delivery_option);
 
 
         $vars = array(
             /*'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array(
                     'carriers' => $carriers,
                     'checked' => $checked,
                     'delivery_option_list' => $delivery_option_list,
                     'delivery_option' => $delivery_option
                 ))*  /
         );
 
         JeproshopCartModelCart::addExtraCarriers($vars);
 
         $view->assignRef('extra_carriers', $vars);
     }
 
     /**
      * Decides what the default carrier is and update the cart with it
      *
      * @todo this function must be modified - id_carrier is now delivery_option
      *
      * @param array $carriers
      *
      * @deprecated since 1.5.0
      *
      * @return number the id of the default carrier
      * /
     protected function setDefaultCarrierSelection($carriers) {
         $context = JeproshopContext::getContext();
         if (!$context->cart->getDeliveryOption(null, true))
             $context->cart->setDeliveryOption($context->cart->getDeliveryOption());
     }*/
 public function globalInitialization()
 {
     $app = JFactory::getApplication();
     $view = $app->input->get('view');
     $viewClass = $this->getView($view, JFactory::getDocument()->getType());
     $context = JeproshopContext::getContext();
     $this->isLogged = (bool) ($context->customer->customer_id && JeproshopCustomerModelCustomer::customerIdExistsStatic((int) $context->cookie->customer_id));
     parent::initialize();
     /* Disable some cache related bugs on the cart/order */
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     if (!$context->customer->isLogged(true) && $this->useMobileTheme() && $app->input->get('step')) {
         $app->redirect(JRoute::_('index.php?option=com_jeproshop&view=authentication&lang_id=' . $context->language->lang_id, true, 1));
     }
     // Redirect to the good order process
     $task = $app->input->get('task', '');
     $order_process_type = JeproshopSettingModelSetting::getValue('order_process_type');
     if ($order_process_type == 'standard' && ($task != '' || $task != 'display')) {
         //$app->redirect('index.php?option=com_jeproshop&view=order');
     }
     if ($order_process_type == 'page_checkout' && $task != 'opc') {
         $step = $app->input->get('step');
         if (isset($step) && $step == 3) {
             $app->redirect('index.php?option=com_jeproshop&view=order&task=opc&isPaymentStep=true');
         }
         $app->redirect('index.php?option=com_jeproshop&view=order&task=opc');
     }
     $catalog_mode = JeproshopSettingModelSetting::getValue('catalog_mode');
     if ($catalog_mode) {
         $this->has_errors = true;
         JError::raiseError(500, JText::_('COM_JEPROSHOP_THIS_STORE_DOES_NOT_ACCEPT_NEW_ORDER_MESSAGE'));
     }
     $order_id = (int) $app->input->get('order_id');
     $currentTask = $app->input->get('task');
     if ($currentTask == 'submitReorder' && $order_id) {
         $oldCart = new JeproshopCartModelCart(JeproshopOrderModelOrder::getStaticCartId($order_id, $context->customer->customer_id));
         $duplication = $oldCart->duplicate();
         if (!$duplication || !JeproshopTools::isLoadedObject($duplication->cart, 'cart_id')) {
             $this->has_errors = true;
             Tools::displayError('Sorry. We cannot renew your order.');
         } else {
             if (!$duplication->success) {
                 $this->has_errors = true;
                 Tools::displayError('Some items are no longer available, and we are unable to renew your order.');
             } else {
                 $context->cookie->cart_id = $duplication->cart->cart_id;
                 $context->cookie->write();
                 if ($order_process_type == 'page_checkout') {
                     $app->redirect('index.php?option=com_jeproshop&view=order&task=opc');
                 }
                 $app->redirect('index.php?option=com_jeproshop&view=order');
             }
         }
     }
     $viewClass->assignRef('order_process_type', $order_process_type);
     $nbProducts = $context->cart->numberOfProducts();
     if ($nbProducts) {
         if (JeproshopCartRuleModelCartRule::isFeaturePublished()) {
             if (Tools::isSubmit('submitAddDiscount')) {
                 if (!($code = trim(Tools::getValue('discount_name')))) {
                     $this->has_errors = true;
                     JError::raiseError('You must enter a voucher code.');
                 } elseif (!Validate::isCleanHtml($code)) {
                     $this->has_errors = true;
                     JEroor::raiseError('The voucher code is invalid.');
                 } else {
                     $cartRule = new JeproshopCartRuleModelCartRule(JeproshopCartRuleModelCartRule::getIdByCode($code));
                     if ($cartRule && JeproshopTools::isLoadedObject($cartRule, 'cart_rule_id')) {
                         if ($error = $cartRule->checkValidity($context, false, true)) {
                             $this->has_errors = true;
                             JError::raiseError(500, $error);
                         } else {
                             $context->cart->addCartRule($cartRule->cart_rule_id);
                             if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
                                 Tools::redirect('index.php?controller=order-opc&addingCartRule=1');
                             }
                             Tools::redirect('index.php?controller=order&task=adding_cart_rule');
                         }
                     } else {
                         $this->has_errors = true;
                         Tools::displayError('This voucher does not exists.');
                     }
                 }
                 $discountName = JeproshopTools::safeOutput($code);
                 $viewClass->assignRef('discount_name', $discountName);
             } elseif (($cart_rule_id = (int) Tools::getValue('delete_discount')) && JeproshopTools::isUnsignedId($cart_rule_id)) {
                 $context->cart->removeCartRule($cart_rule_id);
                 $app->redirect('index.php?option=com_jeproshop&view=order&task=opc');
             }
         }
         /* Is there only virtual product in cart */
         if ($isVirtualCart = $context->cart->isVirtualCart()) {
             $this->setNoCarrier();
         }
     }
     //$viewClass->assignRef('back', JTools::safeOutput(Tools::getValue('back')));*/
 }
Beispiel #7
0
 public function setMedia()
 {
     parent::setMedia();
     $document = JFactory::getDocument();
     $path = JURI::base() . 'components/com_jeproshop/assets/';
     if (!$this->useMobileTheme()) {
         //$this->addCSS(_THEME_CSS_DIR_ . 'authentication.css');
     }
     //$this->addJqueryPlugin('typewatch');
     foreach (array('jeprovat.js', 'jeprostate.js', 'jeproauthentication.js', 'jeprotools.js') as $js) {
         $document->addScript($path . 'javascript/script/' . $js);
     }
 }
Beispiel #8
0
 /**
  * Initialize cart controller
  * @see FrontController::init()
  */
 public function init()
 {
     if (!$this->context || $this->context == null) {
         $this->context = JeproshopContext::getContext();
     }
     parent::init();
     // Send noindex to avoid ghost carts by bots
     header("X-Robots-Tag: noindex, nofollow", true);
     $app = JFactory::getApplication();
     // Get page main parameters
     $this->product_id = (int) $app->input->get('product_id', null);
     $this->product_attribute_id = (int) $app->input->get('product_attribute_id', $app->input->get('product_attribute_id'));
     $this->customization_id = (int) $app->input->get('customization_id');
     $this->quantity = abs($app->input->get('quantity', 1));
     $this->address_delivery_id = (int) $app->input->get('address_delivery_id');
     $this->use_ajax = $app->input->get('use_ajax');
 }
Beispiel #9
0
 /**
  * Return current category childs
  *
  * @param integer $lang_id Language ID
  * @param boolean $published return only active categories
  * @return array Categories
  */
 public function getSubCategories($lang_id, $published = true)
 {
     $sql_groups_where = '';
     $sql_groups_join = '';
     $db = JFactory::getDBO();
     if (JeproshopGroupModelGroup::isFeaturePublished()) {
         $sql_groups_join = " LEFT JOIN " . $db->quoteName('#__jeproshop_category_group') . " AS category_group ON (category_group." . $db->quoteName('category_id') . " = category." . $db->quoteName('category_id') . ")";
         $groups = JeproshopController::getCurrentCustomerGroups();
         $sql_groups_where = " AND category_group." . $db->quoteName('group_id') . " " . (count($groups) ? " IN (" . implode(',', $groups) . ")" : " = " . (int) JeproshopGroupModelGroup::getCurrent()->group_id);
     }
     $query = "SELECT category.*, category_lang.lang_id, category_lang.name, category_lang.description, category_lang.link_rewrite, category_lang.meta_title, category_lang.meta_keywords, ";
     $query .= " category_lang.meta_description FROM " . $db->quoteName('#__jeproshop_category') . " AS category " . JeproshopShopModelShop::addSqlAssociation('category') . " LEFT JOIN ";
     $query .= $db->quoteName('#__jeproshop_category_lang') . " AS category_lang ON (category." . $db->quoteName('category_id') . " = category_lang." . $db->quoteName('category_id');
     $query .= " AND " . $db->quoteName('lang_id') . " = " . (int) $lang_id . " " . JeproshopShopModelShop::addSqlRestrictionOnLang('category_lang') . ") " . $sql_groups_join;
     $query .= " WHERE " . $db->quoteName('parent_id') . " = " . (int) $this->category_id . ($published ? " AND " . $db->quoteName('published') . " = 1 " : "") . $sql_groups_where;
     $query .= "\tGROUP BY category." . $db->quoteName('category_id') . " ORDER BY " . $db->quoteName('depth_level') . " ASC, category_shop." . $db->quoteName('position') . " ASC";
     $db->setQuery($query);
     $result = $db->loadObjectList();
     foreach ($result as &$row) {
         $row->image_id = JeproshopTools::file_exists_cache(COM_JEPROSHOP_CATEGORY_IMAGE_DIRECTORY . $row->category_id . '.jpg') ? (int) $row->category_id : JeproshopLanguageModelLanguage::getIsoById($lang_id) . '_default';
         $row->legend = JText::_('COM_JEPROSHOP_NO_PICTURE_LABEL');
     }
     return $result;
 }
Beispiel #10
0
 public static function searchTag($id_lang, $tag, $count = false, $pageNumber = 0, $pageSize = 10, $orderBy = false, $orderWay = false, $useCookie = true, JeproshopContext $context = null)
 {
     if (!$context) {
         $context = JeproshopContext::getContext();
     }
     // Only use cookie if id_customer is not present
     if ($useCookie) {
         $customer_id = (int) $context->customer->customer_id;
     } else {
         $customer_id = 0;
     }
     if (!is_numeric($pageNumber) || !is_numeric($pageSize) || !Validate::isBool($count) || !Validate::isValidSearch($tag) || $orderBy && !$orderWay || $orderBy && !Validate::isOrderBy($orderBy) || $orderWay && !Validate::isOrderBy($orderWay)) {
         return false;
     }
     if ($pageNumber < 1) {
         $pageNumber = 1;
     }
     if ($pageSize < 1) {
         $pageSize = 10;
     }
     $shop_id = JeproshopContext::getContext()->shop->shop_id;
     $shop_id = $shop_id ? $shop_id : JeproshopSettingModelSetting::getValue('default_shop');
     $sql_groups = '';
     if (JeproshopGroupModelGroup::isFeaturePublished()) {
         $groups = JeproshopController::getCurrentCustomerGroups();
         $sql_groups = " AND customer_group." . $db->quoteName('group_id') . (count($groups) ? " IN (" . implode(',', $groups) . ")" : "= 1");
     }
     if ($count) {
         $query = "SELECT COUNT(DISTINCT product_tag." . $db->quoteName('product_id') . ") nb FROM " . $db->quoteName('#__jeproshop_product');
         $query .= " AS product " . JeproshopShopModelShop::addSqlAssociation('product') . "\tLEFT JOIN " . $db->quoteName('#__jeproshop_product_tag');
         $query .= " AS product_tag ON (product." . $db->quoteName('product_id') . " = product_tag." . $db->quoteName('product_id') . ") LEFT JOIN ";
         $query .= $db->quoteName('#__jeproshop_tag') . " AS tag ON (product_tag." . $db->quoteName('tag_id') . " = tag." . $db->quoteName('tag_id');
         $query .= " AND tag." . $db->quoteName('lang_id') . " = " . (int) $lang_id . ") LEFT JOIN " . $db->quoteName('#__jeproshop_product_category');
         $query .= " AS product_category ON (product_category." . $db->quoteName('product_id') . " = product." . $db->quoteName('product_id') . ") LEFT JOIN ";
         $query .= $db->quoteName('#__jeproshop_category_shop') . " AS category_shop ON (product_category." . $db->quoteName('category_id') . " = category_shop.";
         $query .= $db->quoteName('category_id') . " AND category_shop." . $db->quoteName('shop_id') . " = " . (int) $shop_id . ") ";
         $query .= JeproshopGroupModelGroup::isFeaturePublished() ? " LEFT JOIN " . $db->quoteName('#__jeproshop_category_group') . " AS category_group ON (category_group." . $db->quoteName('category_id') . " = product_category." . $db->quoteName('category_id') . ")" : "";
         $query .= "\tWHERE product_shop." . $db->quoteName('publishd') . " = 1 AND product.visibility IN ('both', 'search') AND category_shop." . $db->quoteName('shop_id');
         $query .= " = " . (int) JeproshopContext::getContext()->shop->shop_id . $sql_groups . " AND tag." . $db->quoteName('name') . " LIKE '%'" . $db->quote($tag) . "'%')";
         /*$query .= " } 
         	
         				$sql = 'SELECT DISTINCT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
         					MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name, 1 position,
         					DATEDIFF(
         						p.`date_add`,
         						DATE_SUB(
         							NOW(),
         							INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY
         						)
         					) > 0 new
         				FROM `' $db->quoteName('#__jeproshop_product` p
         				INNER JOIN `'.$db->quoteName('#__jeproshop_product_lang` pl ON (
         					p.`id_product` = pl.`id_product`
         					AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
         				)'.Shop::addSqlAssociation('product', 'p', false).'
         				LEFT JOIN `'.$db->quoteName('#__jeproshop_image` i ON (i.`id_product` = p.`id_product`)'.
         					Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
         				LEFT JOIN `' . $db->quoteName('#__jeproshop_image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
         				LEFT JOIN `'. $db->quoteName('#__jeproshop_manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
         				LEFT JOIN `'. $db->quoteName('#__jeproshop_product_tag` pt ON (p.`id_product` = pt.`id_product`)
         				LEFT JOIN `'. $db->quoteName('#__jeproshop_tag` t ON (pt.`id_tag` = t.`id_tag` AND t.`id_lang` = '.(int)$id_lang.')
         				LEFT JOIN `'. $db->quoteName('#__jeproshop_category_product` cp ON (cp.`id_product` = p.`id_product`)
         				'.(Group::isFeatureActive() ? 'LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`)' : '').'
         				LEFT JOIN `'. $db->quoteName('#__jeproshop_category_shop` cs ON (cp.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')
         				'.Product::sqlStock('p', 0).'
         				WHERE product_shop.`active` = 1
         					AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.'
         					'.$sql_groups.'
         					AND t.`name` LIKE \'%'.pSQL($tag).'%\'
         					return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
         			
         				
         					GROUP BY product_shop.id_product
         				ORDER BY position DESC'.($orderBy ? ', '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
         				LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
         				$db->setQuery($query);
         				$result = $db->loadObjectList();
         				if (!$result)
         					return false; */
     }
     return JeproshopProductModelProduct::getProductsProperties((int) $lang_id, $result);
 }
Beispiel #11
0
 public function initContent()
 {
     parent::initContent();
     if (!$this->has_errors) {
     }
 }
Beispiel #12
0
 public function initialize()
 {
     if (self::$_initialized) {
         return;
     }
     $app = JFactory::getApplication();
     $context = JeproshopContext::getContext();
     if ($app->input->get('use_ajax')) {
         $this->use_ajax = true;
     }
     /* Server Params
        $protocol_link = (JeproshopTools::usingSecureMode() && JeproshopSettingModelSetting::getValue('enable_ssl')) ? 'https://' : 'http://';
        $protocol_content = (JeproshopTools::usingSecureMode() && JeproshopSettingModelSetting::getValue('enable_ssl')) ? 'https://' : 'http://';
        */
     if (isset($_GET['logout'])) {
         $context->employee->logout();
     }
     if (isset(JeproshopContext::getContext()->cookie->last_activity)) {
         if ($context->cookie->last_activity + 900 < time()) {
             $context->employee->logout();
         } else {
             $context->cookie->last_activity = time();
         }
     }
     $controllerName = $app->input->get('view');
     if ($controllerName != 'authenticate' && (!isset($context->employee) || !$context->employee->isLoggedBack())) {
         if (isset($context->employee)) {
             $context->employee->logout();
         }
         $email = false;
         if ($app->input->get('email') && JeproshopTools::isEmail($app->inpt->get('email'))) {
             $email = $app->input->get('email');
         }
         //$app->redirect($this->getAdminLink('AdminLogin').((!isset($_GET['logout']) && $controllerName != 'AdminNotFound' && $app->input->get('view')) ? '&redirect=' . $controllerName : '').($email ? '&email='.$email : ''));
     }
     $current_index = 'index.php?option=com_jeproshop' . ($controllerName ? 'view=' . $controllerName : '');
     if ($app->input->get('return')) {
         $current_index .= '&return=' . urlencode($app->input->get('return'));
     }
     self::$_current_index = $current_index;
     if ($this->use_ajax && method_exists($this, 'ajaxPreProcess')) {
         $this->ajaxPreProcess();
     }
     self::$_initialized = true;
     $this->initProcess();
 }
Beispiel #13
0
 public static function getCurrentCustomerGroups()
 {
     if (!JeproshopGroupModelGroup::isFeaturePublished()) {
         return array();
     }
     $context = JeproshopContext::getContext();
     if (!isset($context->customer) || !$context->customer->customer_id) {
         return array();
     }
     if (!is_array(self::$currentCustomerGroups)) {
         self::$currentCustomerGroups = array();
         $db = JFactory::getDBO();
         $query = "SELECT group_id FROM " . $db->quoteName('#__jeproshop_customer_group') . " WHERE customer_id = " . (int) $context->customer->customer_id;
         $db->setQuery($query);
         $result = $db->loadObjectList();
         foreach ($result as $row) {
             self::$currentCustomerGroups[] = $row->group_id;
         }
     }
     return self::$currentCustomerGroups;
 }