// Fix search on multishop

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8150 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-22 16:10:17 +00:00
parent a4f6bde797
commit d7eaa5f5a4
3 changed files with 9 additions and 4 deletions
+7 -2
View File
@@ -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<br />Please use the following URL instead: <a href="'.$canonicalURL.$params.'">'.$canonicalURL.$params.'</a>');
Tools::redirectLink($canonicalURL.$params);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -30,8 +30,8 @@
<form method="get" action="{$link->getPageLink('search')}" id="searchbox">
<p>
<label for="search_query_top"><!-- image on background --></label>
<input type="hidden" name="orderby" value="position" />
<input type="hidden" name="controller" value="search" />
<input type="hidden" name="orderby" value="position" />
<input type="hidden" name="orderway" value="desc" />
<input class="search_query" type="text" id="search_query_top" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{/if}" />
<input type="submit" name="submit_search" value="{l s='Search' mod='blocksearch'}" class="button" />