[-] FO: Fix lang links when url rewrite is not activated
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)
|
* @var bool If true, use routes to build URL (mod rewrite must be activated)
|
||||||
*/
|
*/
|
||||||
protected $use_routes = false;
|
protected $use_routes = false;
|
||||||
|
|
||||||
|
protected $multilang_activated = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array List of loaded routes
|
* @var array List of loaded routes
|
||||||
*/
|
*/
|
||||||
@@ -225,6 +227,9 @@ class DispatcherCore
|
|||||||
if ($this->front_controller == self::FC_FRONT)
|
if ($this->front_controller == self::FC_FRONT)
|
||||||
Tools::switchLanguage();
|
Tools::switchLanguage();
|
||||||
|
|
||||||
|
if (Language::isMultiLanguageActivated())
|
||||||
|
$this->multilang_activated = true;
|
||||||
|
|
||||||
$this->loadRoutes();
|
$this->loadRoutes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,7 +621,11 @@ class DispatcherCore
|
|||||||
|
|
||||||
if (!empty($route['controller']))
|
if (!empty($route['controller']))
|
||||||
$query_params['controller'] = $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;
|
return $url.$anchor;
|
||||||
|
|||||||
+2
-14
@@ -399,20 +399,8 @@ class ToolsCore
|
|||||||
$context->language = $language;
|
$context->language = $language;
|
||||||
|
|
||||||
$params = $_GET;
|
$params = $_GET;
|
||||||
unset($params['id_lang']);
|
if (Configuration::get('PS_REWRITING_SETTINGS') || !Language::isMultiLanguageActivated())
|
||||||
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user