diff --git a/classes/FrontController.php b/classes/FrontController.php index aed0912b3..134a145c7 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -384,11 +384,16 @@ class FrontControllerCore if (!Tools::getValue('ajax') && !preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', (($this->ssl AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) { header('HTTP/1.0 301 Moved'); - $params = ''; + $params = array(); $excludedKey = array('isolang', 'id_lang', 'controller'); foreach ($_GET as $key => $value) if (!in_array($key, $excludedKey)) - $params .= ($params == '' ? '?' : '&').$key.'='.$value; + $params[] = $key.'='.$value; + if ($params) + $params = ((strpos($canonicalURL, '?') === false) ? '?' : '&').implode('&', $params); + else + $params = ''; + if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_ AND $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) die('[Debug] This page has moved
Please use the following URL instead: '.$canonicalURL.$params.''); Tools::redirectLink($canonicalURL.$params); diff --git a/controllers/SearchController.php b/controllers/SearchController.php index e9d0376a9..55d32c387 100644 --- a/controllers/SearchController.php +++ b/controllers/SearchController.php @@ -74,7 +74,7 @@ class SearchControllerCore extends FrontController $this->productSort(); $this->n = abs((int)(Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')))); $this->p = abs((int)(Tools::getValue('p', 1))); - $search = Search::find($this->context->language->id, $query, false, $this->p, $this->n, $this->orderBy, $this->orderWay); + $search = Search::find($this->context->language->id, $query, $this->p, $this->n, $this->orderBy, $this->orderWay); Module::hookExec('search', array('expr' => $query, 'total' => $search['total'])); $nbProducts = $search['total']; $this->pagination($nbProducts); diff --git a/modules/blocksearch/blocksearch-top.tpl b/modules/blocksearch/blocksearch-top.tpl index f97391cb3..c34333ff8 100644 --- a/modules/blocksearch/blocksearch-top.tpl +++ b/modules/blocksearch/blocksearch-top.tpl @@ -30,8 +30,8 @@