Jump to content

Recommended Posts

I adjusted the header area for Prestashop 1.6 some time ago and it worked really well. Now I have updated the version to 1.7.2. But the code I used for version 1.6 no longer works for version 1.7.2. I have adapted the code for the new version. Only one thing is missing and that, I would like to read all available languages and then insert into the tag rel = "alternate".

In short, I want to rewrite this code for Prestashop 1.7:

{foreach $ languages as $ lang} <link rel = "alternate" hreflang = "{$ lang.iso_code}" href = "{$ link-> getCategoryLink ($ smarty.get.id_category, null, $ lang.id_lang, null , null)} "/> {/ foreach}

So it would look like

  <link rel="alternate" href="{$urls.current_url}" hreflang="de" />
  <link rel="alternate" href="{$urls.current_url}" hreflang="en" />
  <link rel="alternate" href="{$urls.current_url}" hreflang="es" />
  <link rel="alternate" href="{$urls.current_url}" hreflang="fr" />

 

Thanks in advance!!!!

 

Ich habe vor einiger Zeit den Headerbereich für Prestashop 1.6 angepasst und das hat super funktioniert. Jetzt habe ich die Version auf 1.7.2 aktualisiert. Aber der Code, den ich für die Version 1.6 benutzt habe, funktioniert nicht mehr für die Version 1.7.2. Ich habe den Code für die neue Version angepasst. Nur eine Sache fehlt noch und zwar, ich möchte alle verfügbaren Sprachen auslesen und dann ins Tag rel="alternate" einfügen.

kurz gesagt, ich möchte diesen Code für Prestashop 1.7 umschreiben:

{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" />{/foreach}

Ausgabe würde so aussehen:

  <link rel="alternate" href="{$urls.current_url}" hreflang="de" />
  <link rel="alternate" href="{$urls.current_url}" hreflang="en" />
  <link rel="alternate" href="{$urls.current_url}" hreflang="es" />
  <link rel="alternate" href="{$urls.current_url}" hreflang="fr" />

 

 

Vielen Dank im Voraus!!!!

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

Hello @androkot33 thank you for your message. I am using already the classic theme. There is the file ps_languageselector.tpl in the folder modules. So I would have to be able to access the variable $ languages. But if I check the variable, it is empty.

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

19 hours ago, androkot33 said:

How did you check variable?

I made a output of the Value of the Variable.

1- {foreach $languages as $lang}{$lang.iso_code}{/foreach}

2- {$languages|@var_dump}

 

I have checked the variable. It is empty. The output will show empty space.

Edited by amro
Update (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...