Uzumymw Posted May 17, 2021 Share Posted May 17, 2021 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? Link to comment Share on other sites More sharing options...
datakick Posted May 17, 2021 Share Posted May 17, 2021 Probably Dispatcher.php Link to comment Share on other sites More sharing options...
Uzumymw Posted May 17, 2021 Author Share Posted May 17, 2021 Ok, i will search. Maybe it would be good to adding this possibility to the system? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now