Jump to content

Leoblog & ps_languageselector : getLanguageLink return url for selected language only


Recommended Posts

I'm on Prestashop 1.7, I'm using Leo template and the Leoblog module for my blog. My site is translated in English and French and I'm using the ps_languageselector module.
However for categories (and articles) when I have the French language selected $link->getLanguageLink($language.id_lang) returns https://mysite/fr/blog/categorie/une-categorie for the French link but returns https://mysite.com/en/blog/categorie/une-categorie for the English link (it should be https://mysite.com/en/blog/category/a-category).

I've been searching for a while but I really don't understand where is the issue.  The table id_leoblogcat is filled and has the translations for both languages, all articles have slug translations in both languages.
 

Has anyone ever had this issue ? Is there a workaround ?

/* ps_languageselector.tpl */
<div class="language-selector-wrapper float-xs-left float-sm-right" id="language-selector-label">
      {foreach from=$languages item=language}
        <span {if $language.id_lang == $current_language.id_lang} class="current" {/if}>
          <a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}">
            <img src="{$urls.img_lang_url|escape:'html':'UTF-8'}{$language.id_lang|escape:'html':'UTF-8'}.jpg" alt="{$language.iso_code|escape:'html':'UTF-8'}" width="16" height="11" /></a>
        </span>
      {/foreach}
</div>

 

Link to comment
Share on other sites

  • 2 years later...
  • 8 months later...

Exactly same issue as MayaE described.

I know the topic is quite old but have you found a solution ?

On 4/16/2019 at 2:58 PM, mayaE said:

I'm on Prestashop 1.7, I'm using Leo template and the Leoblog module for my blog. My site is translated in English and French and I'm using the ps_languageselector module.
However for categories (and articles) when I have the French language selected $link->getLanguageLink($language.id_lang) returns https://mysite/fr/blog/categorie/une-categorie for the French link but returns https://mysite.com/en/blog/categorie/une-categorie for the English link (it should be https://mysite.com/en/blog/category/a-category).

I've been searching for a while but I really don't understand where is the issue.  The table id_leoblogcat is filled and has the translations for both languages, all articles have slug translations in both languages.
 

Has anyone ever had this issue ? Is there a workaround ?

/* ps_languageselector.tpl */
<div class="language-selector-wrapper float-xs-left float-sm-right" id="language-selector-label">
      {foreach from=$languages item=language}
        <span {if $language.id_lang == $current_language.id_lang} class="current" {/if}>
          <a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}">
            <img src="{$urls.img_lang_url|escape:'html':'UTF-8'}{$language.id_lang|escape:'html':'UTF-8'}.jpg" alt="{$language.iso_code|escape:'html':'UTF-8'}" width="16" height="11" /></a>
        </span>
      {/foreach}
</div>

 

 

On 12/17/2021 at 11:14 AM, pullidea-dev said:

Same issue here.

/fr/blog/article/attitude-luxe-septembre-2021-france.html (correct)
/fr/blog/detail/attitude-luxe-septembre-2021-france.html (correct)

but

/en/blog/article/attitude-luxe-septembre-2021-france.html (wrong)

 

 

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...