Hello,
i would like to remove default language code from my url. I found few solutions from PS 1.6 but they don't work completely (blog urls still have an language code, categories and product pages are 404). What i do:
1. added /override/classes/Link.php
<?php
class Link extends LinkCore
{
public function getLangLink($idLang = null, Context $context = null, $idShop = null)
{
$parent_result = parent::getLangLink($idLang, $context, $idShop);
if ($parent_result)
{
if ($idLang == Configuration::get('PS_LANG_DEFAULT'))
{
return '';
}
else
{
return $parent_result;
}
}
}
}
?>
2. added file /override/classes/Tools.php
<?php
class Tools extends ToolsCore
{
public static function setCookieLanguage($cookie = null)
{
parent::setCookieLanguage($cookie);
if (!$cookie)
{
$cookie = Context::getContext()->cookie;
}
if(!Tools::getValue('isolang') && !Tools::getValue('id_lang') && !Tools::isSubmit('id_category_layered'))
{
$cookie->id_lang = Configuration::get('PS_LANG_DEFAULT');
Context::getContext()->language = new Language($cookie->id_lang);
}
if (!$cookie->id_lang || !Validate::isUnsignedId($cookie->id_lang))
{
$cookie->id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
Context::getContext()->language = new Language($cookie->id_lang);
}
$iso = Language::getIsoById((int) $cookie->id_lang);
@include_once(_PS_THEME_DIR_.'lang/'.$iso.'.php');
return $iso;
}
}
Any ideas what classes should I modify too?