[-] FO: Fix lang links when url rewrite is not activated
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16308 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+11
-2
@@ -143,7 +143,9 @@ class DispatcherCore
|
||||
* @var bool If true, use routes to build URL (mod rewrite must be activated)
|
||||
*/
|
||||
protected $use_routes = false;
|
||||
|
||||
|
||||
protected $multilang_activated = false;
|
||||
|
||||
/**
|
||||
* @var array List of loaded routes
|
||||
*/
|
||||
@@ -225,6 +227,9 @@ class DispatcherCore
|
||||
if ($this->front_controller == self::FC_FRONT)
|
||||
Tools::switchLanguage();
|
||||
|
||||
if (Language::isMultiLanguageActivated())
|
||||
$this->multilang_activated = true;
|
||||
|
||||
$this->loadRoutes();
|
||||
}
|
||||
|
||||
@@ -616,7 +621,11 @@ class DispatcherCore
|
||||
|
||||
if (!empty($route['controller']))
|
||||
$query_params['controller'] = $route['controller'];
|
||||
$url = 'index.php?'.http_build_query(array_merge($add_params, $query_params), '', '&');
|
||||
$query = http_build_query(array_merge($add_params, $query_params), '', '&');
|
||||
if ($this->multilang_activated)
|
||||
$query .= (!empty($query) ? '&' : '').'id_lang='.(int)$id_lang;
|
||||
$url = 'index.php?'.$query;
|
||||
|
||||
}
|
||||
|
||||
return $url.$anchor;
|
||||
|
||||
+2
-14
@@ -399,20 +399,8 @@ class ToolsCore
|
||||
$context->language = $language;
|
||||
|
||||
$params = $_GET;
|
||||
unset($params['id_lang']);
|
||||
|
||||
if (!Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
{
|
||||
if (empty($params['controller']))
|
||||
unset($params['controller']);
|
||||
elseif (!empty(Context::getContext()->controller->php_self))
|
||||
$params['controller'] = Context::getContext()->controller->php_self;
|
||||
|
||||
if (empty($params))
|
||||
Tools::redirect('index.php');
|
||||
else
|
||||
Tools::redirect('index.php?'.http_build_query($params));
|
||||
}
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS') || !Language::isMultiLanguageActivated())
|
||||
unset($params['id_lang']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user