Jump to content

PS_LANG_DEFAULT on page index


apavlinets

Recommended Posts

Please tell me how to set a condition for changing the default language for a given page (index - home page).

I'll give an example.
By default, in the admin panel, the ru language and the module have removed the identifier on pages with the default language.
Pages submitted to the index google.
You need to set the main page uk but without an identifier, and the links will already work with an identifier.

I look in the direction of adding a condition to the controller (class) to check the type ...

{ if page==index} $default_language == <id2> { else} normal processing

Tell me where and how to register such a condition

 

 

It seems to have found a place in the module ... or rather, in the override of the class that the Link.php module uses

protected function getLangLink($id_lang = null, Context $context = null, $id_shop = null)
{
if (Configuration::get('FSAU_REMOVE_DEFAULT_LANG', null, null, $id_shop) &&
Language::isMultiLanguageActivated()) {
if (!$id_lang) {
if (is_null($context)) {
$context = Context::getContext();
}
$id_lang = $context->language->id;
}
if ($id_lang == Configuration::get('PS_LANG_DEFAULT', null, null, $id_shop)) {
return '';
}
}
return parent::getLangLink($id_lang, $context, $id_shop);
}

it remains to write a rule for the index(home page) page

Edited by apavlinets (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...