Esempio n. 1
0
 private function _setProductFilterList()
 {
     $productFilterListSource = Tools::getValue('productFilterListSource');
     if (in_array($productFilterListSource, array('best-sales', 'new-products', 'prices-drop', 'search'))) {
         PM_AdvancedSearch4::$productFilterListSource = $productFilterListSource;
         if ($productFilterListSource == 'search') {
             $productFilterListData = @base64_decode(Tools::getValue('productFilterListData'));
             if ($productFilterListData !== false) {
                 if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
                     PM_AdvancedSearch4::$productFilterListData = Tools::replaceAccentedChars(urldecode($productFilterListData));
                 } else {
                     PM_AdvancedSearch4::$productFilterListData = urldecode($productFilterListData);
                 }
                 Module::getInstanceByName('pm_advancedsearch4')->setProductFilterContext();
             }
         }
     }
 }
Esempio n. 2
0
 public function hookHeader()
 {
     if ($this->_isInMaintenance() || $this->_isMobileTheme()) {
         return;
     }
     if (version_compare(_PS_VERSION_, '1.5.0.0', '<')) {
         if (isset($_SERVER['PHP_SELF']) && preg_match('#' . preg_quote('best-sales.php') . '#', $_SERVER['PHP_SELF'])) {
             self::$productFilterListSource = 'best-sales';
         } else {
             if (isset($_SERVER['PHP_SELF']) && preg_match('#' . preg_quote('new-products.php') . '#', $_SERVER['PHP_SELF'])) {
                 self::$productFilterListSource = 'new-products';
             } else {
                 if (isset($_SERVER['PHP_SELF']) && preg_match('#' . preg_quote('prices-drop.php') . '#', $_SERVER['PHP_SELF'])) {
                     self::$productFilterListSource = 'prices-drop';
                 } else {
                     if (isset($_SERVER['PHP_SELF']) && preg_match('#' . preg_quote('search.php') . '#', $_SERVER['PHP_SELF']) && Tools::getIsset('q') && Tools::getValue('q')) {
                         self::$productFilterListData = urldecode(Tools::getValue('q'));
                         self::$productFilterListSource = 'search';
                     }
                 }
             }
         }
     } else {
         if (version_compare(_PS_VERSION_, '1.5.0.0', '>=') && isset($this->_context->controller) && is_object($this->_context->controller) && isset($this->_context->controller->php_self)) {
             if (in_array($this->_context->controller->php_self, array('best-sales', 'new-products', 'prices-drop', 'search'))) {
                 self::$productFilterListSource = $this->_context->controller->php_self;
                 if ($this->_context->controller->php_self == 'search' && Tools::getIsset('search_query') && Tools::getValue('search_query')) {
                     self::$productFilterListData = Tools::replaceAccentedChars(urldecode(Tools::getValue('search_query')));
                 }
             }
         }
     }
     $this->setProductFilterContext();
     $this->_addCSS(__PS_BASE_URI__ . 'modules/' . $this->name . '/css/' . $this->name . '.css', 'all');
     $this->_addCSS(__PS_BASE_URI__ . 'modules/' . $this->name . '/' . self::DYN_CSS_FILE, 'all');
     $this->_addCSS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jqueryui/ui_theme_front/theme1/jquery-ui-1.8.13.custom.css', 'all');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jquery.min.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jqueryui/1.8.9/jquery-ui-1.8.9.custom.min.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jqueryui/jquery.ui.touch-punch.min.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/loadjqPm.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jquery.actual.min.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jquery.history/jquery.history.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jquery.history/jquery.observehashchange.pack.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/pm_advancedsearch.js');
     $this->_addJS(__PS_BASE_URI__ . 'modules/' . $this->name . '/js/jquery.form.js');
     if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0) {
         $this->_addJS(_THEME_JS_DIR_ . 'products-comparison.js');
     }
     if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) {
         $ASSearchUrl = $this->_context->link->getModuleLink('pm_advancedsearch4', 'advancedsearch4');
     } else {
         $ASSearchUrl = __PS_BASE_URI__ . 'modules/pm_advancedsearch4/advancedsearch4.php';
     }
     $this->_smarty->assign('ASSearchUrlForm', $ASSearchUrl);
     if (!Tools::getValue('ajaxMode')) {
         $this->assignSearchVar();
     }
     return $this->display(__FILE__, (version_compare(_PS_VERSION_, '1.5.0.0', '<') ? '/views/templates/hook/' : '') . 'pm_advancedsearch_header.tpl');
 }