[-] FO: Fix lang links when url rewrite is not activated

This commit is contained in:
rGaillard
2012-07-10 13:29:02 +00:00
parent 79bc48fe83
commit 71befce59a
2 changed files with 13 additions and 16 deletions
+11 -2
View File
@@ -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
View File
@@ -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']);
}
}