peorthyr Posted May 6, 2014 Share Posted May 6, 2014 (edited) Good day all. I have a shop with several languages, english, french, german, italian, and some other more. the localization indeed has some more countries, such as canada, usa, uk, and so on, so there will be different currencies for example, or some other differences between some country and another. let's say for example that the uk will have pound, and usa will have dollars, both will use english and will have some differences (for example images of the product or some different names and descriptions) i would like to set up a proper hreflang and canonical in the head.tpl of the shop. can anyone lead me to the right way? i'm a little confused. actually i'm try to figure out how to have these link created in the head: <link rel="alternate" hreflang="en-us" href="http://www.example.com/en/page.html" /><link rel="alternate" hreflang="en" href="http://www.example.com/en/page.html" /><link rel="alternate" hreflang="de" href="http://www.example.com/de/seite.html" /> EDIT 1: 07 May 2014 I've posted a similar question on stackoverflow here is the link : http://stackoverflow.com/questions/23539796/duplicate-content-in-prestashop-for-items-in-different-languages hopefully someone will answer. Edited May 8, 2014 by peorthyr (see edit history) Link to comment Share on other sites More sharing options...
peorthyr Posted May 7, 2014 Author Share Posted May 7, 2014 Update 1: talkin with a SEO spec, he told me it could be better to implement a canonical link, not that hreflang one... does anyone has some expreiences that could lead me in some way? Link to comment Share on other sites More sharing options...
Trip Posted May 13, 2014 Share Posted May 13, 2014 Well the href-lang tag is relaitvely new but as google uses it in his own meta tags .look at https://support.google.com/webmasters/answer/189077?hl=en I think your SEO spec is not 100% right. Maybe read this test: http://www.stateofdigital.com/hreflang-canonical-test/ to find out the best solution for you. Well howto automate the hreflang tag. I've rewritten the language selector module today to generate the metadata. Will test that in the next days. Regards, Trip 2 Link to comment Share on other sites More sharing options...
peorthyr Posted May 15, 2014 Author Share Posted May 15, 2014 (edited) I've finally write down a module that does what I need, so, for each page it is called, it create the links to the same page in different langages and put those links in the head with the rel="alternate", I'l provide the code as soon as I will test in production. @trip: yes, i agree with you, the canonical is used for other kind of issues, in the case of different languages or worst, same languages but different locales (en-ca,en-us....) the way is the hreflang. thanks for the answer! UPDATE : Here is the link: http://www.matteobononi.it/prestashop_module_hreflang.php Edited May 16, 2014 by peorthyr (see edit history) 7 Link to comment Share on other sites More sharing options...
mark-b Posted June 5, 2014 Share Posted June 5, 2014 (edited) Hi, Your module works great, there is only a little issue to be fixed: index of cms pages are resulting in 404 errors: www.domain.com/en/content/category/1-home will be generated in the other languages to: <link rel="alternate" hreflang="de" href="http://www.domain.com/de/content/-" /> can you fix this? Edited June 5, 2014 by mark-b (see edit history) Link to comment Share on other sites More sharing options...
keitaro Posted July 18, 2014 Share Posted July 18, 2014 peorthyr thanks for the module very helpful. 1 Link to comment Share on other sites More sharing options...
Trip Posted July 18, 2014 Share Posted July 18, 2014 Tip: Google has a dedicated section in their webmaster tools where you can see if there are problems with the hreflang tag. Very cool because I already found errors in my implemetation. All the best, Trip Link to comment Share on other sites More sharing options...
Trip Posted July 21, 2014 Share Posted July 21, 2014 Here is the article from google "Troubleshooting hreflang annotations in Webmaster Tools" http://googlewebmastercentral.blogspot.de/2014/07/troubleshooting-hreflang-annotations-in.html Link to comment Share on other sites More sharing options...
the.rampage.rado Posted July 23, 2014 Share Posted July 23, 2014 Does anybody have more information about this? Is there a working module for hreflang already? Link to comment Share on other sites More sharing options...
iggywebprom Posted July 23, 2014 Share Posted July 23, 2014 for me module works great on latest prestashop version, except doesn't show on homepage, but shows on categories and products. I have 2 errors in webmaster tools becasue russian is hidden for now, but other languages are ok. http://www.polcomedical.com/en/6-rehabilitation-equipment Link to comment Share on other sites More sharing options...
the.rampage.rado Posted July 23, 2014 Share Posted July 23, 2014 How to implement it? I would like to test on 1.5.6.2. Link to comment Share on other sites More sharing options...
iggywebprom Posted July 23, 2014 Share Posted July 23, 2014 just install the module, link provided on top http://www.matteobononi.it/prestashop_module_hreflang.php Link to comment Share on other sites More sharing options...
the.rampage.rado Posted July 23, 2014 Share Posted July 23, 2014 Lol... I didn't see the link. I just installed it and it seems to work just fine on 1.5.6.2. Will see if GWT gives some errors. Link to comment Share on other sites More sharing options...
Galoper Posted July 25, 2014 Share Posted July 25, 2014 Great work Peorthyr. I installed your module on PS 1.5.6. and seems to work well too. Link to comment Share on other sites More sharing options...
the.rampage.rado Posted August 7, 2014 Share Posted August 7, 2014 It seems that GWT is undable to find the markup. After 1 month of using the module GWT still don't report that it can find it. How is it with you? Link to comment Share on other sites More sharing options...
Trip Posted August 8, 2014 Share Posted August 8, 2014 I've already seen changes within a week. Maybe try this tool to validate your site http://flang.dejanseo.com.au/ Best regards, Trip Link to comment Share on other sites More sharing options...
the.rampage.rado Posted August 8, 2014 Share Posted August 8, 2014 This site gives me that I don't have hreflang on my home page (which is true). But it also gives errors on the product pages - We can't found link on alternate location! Obviously the problem comes from that my first language is Bulgarian which is cyrillic because when i check the Enlgish URL for the product page it's ok. My /bg/url contains cyrillic symbols which end up encoded. When I past only the raw cyrillic url (not the encoded version it don't give errors). What can be done? Link to comment Share on other sites More sharing options...
Trip Posted August 9, 2014 Share Posted August 9, 2014 Well I don't think this has something todo with the page encoding but without looking at the page it is relatively hard. It might be that you use an older ps version. There where some bugs concerning language setup e.g. http://forge.prestashop.com/browse/PSCSX-2378 I for myself have to admit that I set lang codes up wrong in the past too. To get an idea open this picuture http://forge.prestashop.com/secure/attachment/24951/PSCSX-2378.JPG Although I would name the first one English(US) Before you use hreflang you should unterstand how it works. For example if you want to target all english speaking countries I would use language code en (not en-en which is invalid) If you want to target the US take en-us and for the UK en-uk. I can not guarentee it but as far as I understand it would not hurt even if you serve the same content on en-us and en-uk and thankfully PS is really nifty when it comes to copying (duplictating) languages so you can copy your english content to a english(us) content in a couple of minutes and after that geotarget that to the US with hreflang. I will definetly try that in the next weeks. Regards, Trip Link to comment Share on other sites More sharing options...
PuntoSex Posted August 25, 2014 Share Posted August 25, 2014 I've finally write down a module that does what I need, so, for each page it is called, it create the links to the same page in different langages and put those links in the head with the rel="alternate", I'l provide the code as soon as I will test in production. @trip: yes, i agree with you, the canonical is used for other kind of issues, in the case of different languages or worst, same languages but different locales (en-ca,en-us....) the way is the hreflang. thanks for the answer! UPDATE : Here is the link: http://www.matteobononi.it/prestashop_module_hreflang.php Thanks for the module. I was looking for something like this. But wouldn't be usefull to do the same for the index? Thanks again. Link to comment Share on other sites More sharing options...
Jebi Posted September 3, 2014 Share Posted September 3, 2014 Thank you it's an awesome module!! Link to comment Share on other sites More sharing options...
Orfila Posted October 11, 2014 Share Posted October 11, 2014 Peorthyr thanks for the module, really useful!!! I have checked on 1.5.6.0 and it´s working. How could I add region? Like this: <link rel="alternate" hreflang="es-ES" Thanks in advance Link to comment Share on other sites More sharing options...
peorthyr Posted October 12, 2014 Author Share Posted October 12, 2014 just add a new language, and translate the page, the module, for each page checks if the translation of that page is present and creates the link. Link to comment Share on other sites More sharing options...
Orfila Posted October 12, 2014 Share Posted October 12, 2014 thanks for your answer, I wanted to avoid creating new language because I do not trust that errors may appear on this process Link to comment Share on other sites More sharing options...
register25 Posted October 19, 2014 Share Posted October 19, 2014 Nice module. Would like to know or it compatible with multistore function when i use different domain names for different languages? Thanks, R25 Link to comment Share on other sites More sharing options...
HaCos Posted November 18, 2014 Share Posted November 18, 2014 (edited) Works like a charm with 1.6.0.9 . Consider adding support of manufactuers & index pages . edit: This was easier that expected. In order to add alternte tags in home page & manufacturers just add on hreflang_on_pages.tpl the following lines: {if $page_name == 'manufacturer'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang , null)}" />{/foreach} {/if} {if $page_name == 'index'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.iso_code}" href="yourdomain.com/{$lang.iso_code}"/>{/foreach} {/if} Edited November 18, 2014 by HaCos (see edit history) Link to comment Share on other sites More sharing options...
the.rampage.rado Posted December 9, 2014 Share Posted December 9, 2014 (edited) Works like a charm with 1.6.0.9 . Consider adding support of manufactuers & index pages . edit: This was easier that expected. In order to add alternte tags in home page & manufacturers just add on hreflang_on_pages.tpl the following lines: {if $page_name == 'manufacturer'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang , null)}" />{/foreach} {/if} {if $page_name == 'index'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.iso_code}" href="yourdomain.com/{$lang.iso_code}"/>{/foreach} {/if} Have to add one trailing / in href="yourdomain.com/{$lang.iso_code}" so it work perfektly. So it become href="yourdomain.com/{$lang.iso_code}/" Working great for one shop but could we pick up the domain on index so it can work with multishop? Edited December 9, 2014 by the.rampage.rado (see edit history) Link to comment Share on other sites More sharing options...
mark-b Posted December 10, 2014 Share Posted December 10, 2014 code is almost correct, but there is a / missing on the end... you now get on index page: domain.com/en it should be domain.com/en/ Link to comment Share on other sites More sharing options...
mark-b Posted December 10, 2014 Share Posted December 10, 2014 (edited) and use the correct language code like this: ( use lang.language_code instead of lang.iso_code, correct me if I'm wrong) But the default language should also refer to the root domain like domain.com and not domain.com/en/ if the default language is english {if $page_name == 'category'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" /> {/foreach} {/if} {if $page_name == 'product'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $lang.id_lang, null, 0, false)}" /> {/foreach} {/if} {if $page_name == 'cms'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" /> {/foreach} {/if} {if $page_name == 'manufacturer'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang , null)}" />{/foreach} {/if} {if $page_name == 'index'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="http://www.domain.com/{$lang.iso_code}"/>{/foreach} {/if} Edited December 10, 2014 by mark-b (see edit history) Link to comment Share on other sites More sharing options...
juvelin Posted December 24, 2014 Share Posted December 24, 2014 thank you very much for the codes, they saved a alot of time. i have a question; as structure of canonical tag is very smiliar to hreflang tag, canonical tags can also be applied by changing template string hreflang="{$lang.language_code} to rel="canonical" and put it every page once easily? or its not necessary? Link to comment Share on other sites More sharing options...
juvelin Posted December 24, 2014 Share Posted December 24, 2014 (edited) and also google advices using hreflang="x-default" where redirection occurs in our case; domain.com -> does redirection to default one domain.com/tr/ -> default language domain.com/en/ -> alternative so i am creating hreflang for index so; <link rel="alternate" href="http://domain.com" hreflang="x-default" /> <link rel="alternate" href="http://domaincom/tr/" hreflang="tr-tr" /> <link rel="alternate" href="http://domaincom/en/" hreflang="en" /> but i like to know if its correct before i apply the change, because an online hreflang checker doesnt validate this usage (flang.dejanseo.com.au/) Edited December 24, 2014 by juvelin (see edit history) 1 Link to comment Share on other sites More sharing options...
easynow Posted January 12, 2015 Share Posted January 12, 2015 and use the correct language code like this: ( use lang.language_code instead of lang.iso_code, correct me if I'm wrong) But the default language should also refer to the root domain like domain.com and not domain.com/en/ if the default language is english {if $page_name == 'category'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" /> {/foreach} {/if} {if $page_name == 'product'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $lang.id_lang, null, 0, false)}" /> {/foreach} {/if} {if $page_name == 'cms'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" /> {/foreach} {/if} {if $page_name == 'manufacturer'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang , null)}" />{/foreach} {/if} {if $page_name == 'index'} {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="http://www.domain.com/{$lang.iso_code}"/>{/foreach} {/if} This works great in 1.5.6.0. But there is a bug. Why this code render in <body></body> label but not in <head></head>? Can anyone solve? Link to comment Share on other sites More sharing options...
nza2k Posted January 12, 2015 Share Posted January 12, 2015 Hi all, First, Peothyr, thank your very much for the module. I am not the first one to ask the question : how to use it with multi store and multi language ? Like : - French in Belgium : http://www.selfaquashop.be/fr/5-filtration-antitartre - Dutch in Belgium : http://www.selfaquashop.be/nl/5-filtration - French in France : http://www.selfaquashop.fr/5-filtration-antitartre The catalog is not exactly the same for France an Belgium. And as you can see with the example above, folder names may change from French language to dutch language. In other words, there is no "static" rule that would allow to add the hreflang tag on every pages. Thank you for your help 1 Link to comment Share on other sites More sharing options...
peorthyr Posted January 12, 2015 Author Share Posted January 12, 2015 Hi nza2k! Thanks a lot for the comment, well, when i wrote this simple module, I'ven't got in mind the multi store and multi language :/ Well, the module itslef is really simple, it takes that very article and checks in the db if there are other transaltions of it... on a mere logic "it could works". that sayd, i'll take some time to review it and think about a multisite view. But basically if you have the locale/language setted for a given article, then it goes as a hreflang link... Link to comment Share on other sites More sharing options...
nza2k Posted January 15, 2015 Share Posted January 15, 2015 Hi Peorthyr, Thank you for your reply, and sorry for the mispelling on your pseudo. Grazie mille Link to comment Share on other sites More sharing options...
ZiZuu Posted January 28, 2015 Share Posted January 28, 2015 Just installed on ZiZuu.com .. only one language (it) and it seems to work where it is added .. but on some pages no hreflang is present .. - no hreflang in HP - no on /contatti Maybe a pretty url issue? Link to comment Share on other sites More sharing options...
pel024 Posted February 11, 2015 Share Posted February 11, 2015 Hi peorthyr, I don't seem to be able to download the module from your site, is it still available? Link to comment Share on other sites More sharing options...
peorthyr Posted February 11, 2015 Author Share Posted February 11, 2015 sorry for that, the module will be online again soon, I've disabled the download for now, just to make some improvements and some restyling on the site. Link to comment Share on other sites More sharing options...
urkho Posted February 14, 2015 Share Posted February 14, 2015 sorry for that, the module will be online again soon, I've disabled the download for now, just to make some improvements and some restyling on the site. Thanks peorthyr. Please post here when you finish it. I'm also looking forward to installing it in my site. Link to comment Share on other sites More sharing options...
the.rampage.rado Posted February 14, 2015 Share Posted February 14, 2015 Just installed on ZiZuu.com .. only one language (it) and it seems to work where it is added .. but on some pages no hreflang is present .. - no hreflang in HP - no on /contatti Maybe a pretty url issue? The module is made for product/category pages only and we added few rows in it for the index pages but such pages as CMS and contacts are not covered for now. Link to comment Share on other sites More sharing options...
Tommix Posted March 5, 2015 Share Posted March 5, 2015 (edited) hi, can you provide working link to module? your website download doesn't work. edit: nevermind don't see logic to use this module if only works in few pages. Edited March 5, 2015 by Tommix (see edit history) Link to comment Share on other sites More sharing options...
KevinNash Posted March 21, 2015 Share Posted March 21, 2015 Hi, download link is still down Can someone share the module please ? Link to comment Share on other sites More sharing options...
cycleelcyc Posted April 12, 2015 Share Posted April 12, 2015 Hi, download link is still down Can someone share the module please ? need to test this module, my multi lang site has the same issue. thanks to post a link for downloading Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 Same question here, somebody found a way to use it with multi store ? Link to comment Share on other sites More sharing options...
KevinNash Posted April 14, 2015 Share Posted April 14, 2015 I can try but nobody share the module so, please upload it Link to comment Share on other sites More sharing options...
peorthyr Posted April 14, 2015 Author Share Posted April 14, 2015 Hi all. I'm sorry about that delay, but i've got really few spare time, and I need to rewrite most part of the module code due to the validation prestashop has inserted (that's good, a bit of standard never hurts), but this take time. I'll try to dedicate some time to this project, or find some alternative solution. Link to comment Share on other sites More sharing options...
KevinNash Posted April 14, 2015 Share Posted April 14, 2015 Can you please put the previous module online during this time ? Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 Here it is, this is the raw version. You can look a previous post, if you want to adapt it or add the index page. Link to comment Share on other sites More sharing options...
ZiZuu Posted April 14, 2015 Share Posted April 14, 2015 (edited) We have written a module (still beta, but we are confident it is working for the hreflang part) ... https://github.com/ZiZuu-store/PrestaShop_module-zzSEOtk We are working to the canonical url part .. trying to guess the better way to implement .. but this part is not working, so disable it in the config Anybody is kindly asked to report issues and improvements on Github in order to make this module be fully working for everyone. Hope you could enjoy Edited April 14, 2015 by ZiZuu (see edit history) 1 Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 I just install the module and took a look at it. But does not seem to work with compatible shop. For thoses, like me, that use 1 shop for 1 langage (to have one domain per lang), we are looking for a loop with shop and langage. Link to comment Share on other sites More sharing options...
ZiZuu Posted April 14, 2015 Share Posted April 14, 2015 (edited) Let me understand what it should do and I'll implement ASAP .. .. or let me see your site on a page having troubles .. what is the expected behaviour and the actual one ? Edited April 14, 2015 by ZiZuu (see edit history) Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 (edited) It would be very helpfull if you can manage this dev. Let's says we have: www.test.com is Shop 1 with English UK language www.test.de is Shop 2 with German language www.test.fr is Shop 3 with French language www.test.co.uk is Shop 4 with English US language Each shop is a clone of the other, but in different language. HREFLANG We would like to have: <link rel="alternate" href="http://www.test.com/category-test/9-product-test.html" hreflang="en-us" /> <link rel="alternate" href="http://www.test.co.uk/category-test/9-product-test.html" hreflang="en-gb" /> <link rel="alternate" href="http://www.test.de/categorien-testen/9-producten-testen.html" hreflang="de" /> <link rel="alternate" href="http://www.test.fr/categorie-test/9-produuit-test.html" hreflang="fr" /> CANONICAL Normally, canonical is not usefull, because, there should be a 301 redirection. But in case we have 2 shops in English (UK & US), it would be interesting to set the default one, and to have a canonical on the other one, to prevent duplicate content. In this case, if UK english is the default one, we would have on US website on page : http://www.test.com/category-test/9-product-test.html <link href="http://www.test.co.uk/category-test/9-product-test.html" rel="canonical" /> Edited April 14, 2015 by hugolin69 (see edit history) 1 Link to comment Share on other sites More sharing options...
ZiZuu Posted April 14, 2015 Share Posted April 14, 2015 (edited) plz try the last commit .. ok .. I got what you want to obtain .. but what actually are obtaining nowadays instead? Edited April 14, 2015 by ZiZuu (see edit history) 1 Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 Just tried it, but it does not fit. When I look the source code, you filter with the shop_id, but we should have a loop for each shop, and then for each langage. (Only one language activated per shop) Because here, we will have only one hreflang, as there is only one lang per shop. 'shop_languages' => Language::getLanguages(true, (int)$this->context->shop->id) For canonical, the lign should appears only where the actual URL is different from the canonical, according to google. Or in my example, if we set (specially for english US/UK) a default shop that force the canonical. Link to comment Share on other sites More sharing options...
ZiZuu Posted April 14, 2015 Share Posted April 14, 2015 Canonical is a quite more far issue for now .. Uhmm ... I'm thinking if your configuration could be too custom for a general purpose module or not .. I don't have a multishop - multilanguage shop for testing .. so I'm going on blind .. Let me understand. Your page is only ONE and then it has multiple translations or every localized page has its own page id? in the second case I can't argue how to connect them .. how to tell they are the same page in different shops .. 1 Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 I know my case seems to be custom, but many people use multishop, just to have different domain names, for SEO. If you do not use multishop, you will have www.test.com/de and www.test.com/fr. With multishop, you will have www.test.de and www.test.fr, which is really better for SEO. Some people use multishop for differents shops, but many of them, like me, use them only to have one langage for one domain, and delete the /fr /de /en .... We activate only one lang for one shop, in this case prestashop does not use the /fr /de ... Generally, people use the sames products, same categories. ID Product, catagories, CMS still the same. Only special case, is that the system has to test if the product is also enabled in the other shop. 1 Link to comment Share on other sites More sharing options...
ZiZuu Posted April 14, 2015 Share Posted April 14, 2015 Try now plz Link to comment Share on other sites More sharing options...
hugolin69 Posted April 14, 2015 Share Posted April 14, 2015 I just tried, but only thing I have, is it can now detect all the lang, but use always the same shop url, and the same url of visited lang. <link rel="alternate" hreflang="de-de" href="http://www.test.fr/categorie-test/9-produit-test.html" /> <link rel="alternate" hreflang="en-gb" href="http://www.test.fr/categorie-test/9-produit-test.html" /> <link rel="alternate" hreflang="es-es" href="http://www.test.fr/categorie-test/9-produit-test.html" /> <link rel="alternate" hreflang="fr-fr" href="http://www.test.fr/categorie-test/9-produit-test.html" /> <link rel="alternate" hreflang="it-it" href="http://www.test.fr/categorie-test/9-produit-test.html" /> <link rel="alternate" hreflang="en-us" href="http://www.test.fr/categorie-test/9-produit-test.html" /> Should be something like <link rel="alternate" hreflang="de-de" href="http://www.test.de/categorien-testen/9-produit-testen.html" /> <link rel="alternate" hreflang="en-gb" href="http://www.test.co.uk/category-test/9-producy-test.html" /> <link rel="alternate" hreflang="fr-fr" href="http://www.test.fr/categorie-test/9-produit-test.html" /> Prestashop offers a controller for Shops, with function getting the URL etc... 1 Link to comment Share on other sites More sharing options...
ZiZuu Posted April 15, 2015 Share Posted April 15, 2015 Yes I know I'm already using Shops .. I'm confident the logic was right .. there was a typo in the tpl .. used $l.id (non-existant), now fixed and using the right property name $l.id_lang please try again 1 Link to comment Share on other sites More sharing options...
hugolin69 Posted April 15, 2015 Share Posted April 15, 2015 We are pretty close now. Only problem is the domain name. For each alternate, it is using the actual domain. (Each would be www.test.fr if I am in french version), but the rest of the url is now good. I saw in the shop controller, there is a getShopUrl or something like that. Can you manage it ? Thank you man. 1 Link to comment Share on other sites More sharing options...
ZiZuu Posted April 15, 2015 Share Posted April 15, 2015 I was expecting such a behaviour ;( I'll find the way to pass the right context to the Link method .. I don't think we have to retrieve the URL elsewhere than the Link class .. it's its job I made an explicit Shop::setContext(Shop::CONTEXT_ALL); now .. I don't think it will suffice .. but plz try .. meanwhile I dig deeper in the Link class to argue how to force the shop (hoping not to have to complicate the logic bypassing the Link::getLanguages() method ) Link to comment Share on other sites More sharing options...
hugolin69 Posted April 15, 2015 Share Posted April 15, 2015 Nope, still the same. In addition, some products can be disabled or not exist in an other shop (in some specials cases), and we will need to make a test on it first, before adding an alternate link. I agree with your approach keeping the Link class, but I do not think it can lookup in an other shop, and make this verification. Link to comment Share on other sites More sharing options...
ZiZuu Posted April 15, 2015 Share Posted April 15, 2015 ok .. hope it will work now Link to comment Share on other sites More sharing options...
hugolin69 Posted April 15, 2015 Share Posted April 15, 2015 nope .... still the same domain in every lang... Link to comment Share on other sites More sharing options...
ZiZuu Posted April 15, 2015 Share Posted April 15, 2015 I can't believe ;( Today worked on refactoring the module config page .. will look ASAP .. can you debug the $shop.context objects? {$shop.context|print_r} in the template .. let me have it on a wrong page plz Link to comment Share on other sites More sharing options...
hugolin69 Posted April 16, 2015 Share Posted April 16, 2015 What do you mean "on a wrong page" ? The {$shop.context|print_r} in tpl return value "1" in every shop. (This is my ID for Group Shop or id for the french shop) if I place it at the beginning of meta-hreflang.tpl. If I place it into the foreach, I got an error 500. $shop_context->language debug in php inside the loop foreach, returns me always the actual language, maybe it is the source of the problem. getContext() could be maybe a better option than the cloneContext ? Link to comment Share on other sites More sharing options...
ZiZuu Posted April 17, 2015 Share Posted April 17, 2015 Here we are again I think there is a big bug in the CORE class .. it takes Context as argument but NEVER use it Please test the current module revision AND apply the following patch to the classes/Link.php core file diff -uN ./classes/Link.php.orig ./classes/Link.php --- ./classes/Link.php.orig 2015-04-17 09:46:19.519206473 +0200 +++ ./classes/Link.php 2015-04-17 09:53:51.783984770 +0200 [spam-filter] -486,8 +486,8 [spam-filter] $controller = Dispatcher::getInstance()->getController(); - if (!empty(Context::getContext()->controller->php_self)) - $controller = Context::getContext()->controller->php_self; + if (!empty($context->controller->php_self)) + $controller = $context->controller->php_self; if ($controller == 'product' && isset($params['id_product'])) return $this->getProductLink((int)$params['id_product'], null, null, null, (int)$id_lang); The current release inserts two debugging <meta> .. look for XXX- into the page output ... please try and report the output Thank you 1 Link to comment Share on other sites More sharing options...
hugolin69 Posted April 17, 2015 Share Posted April 17, 2015 (edited) I made the patch, and upload last version (You are sure you upload the last version to github ? that show the last update is 2 days ago). I still have the same problem, with always the same domain. (Only one XXX) <link rel="alternate" hreflang="de-de" href="http://www.test.fr/15-cd-regal-" /> <link rel="alternate" hreflang="en-gb" href="http://www.test.fr/15-cd-wall-shelf-'>http://www.test.fr/15-cd-wall-shelf-" /> <link rel="alternate" hreflang="es-es" href="http://www.test.fr/15-estante-para-cd" /> <link rel="alternate" hreflang="fr-fr" href="http://www.test.fr/15-etageres-range-cd" /> <link rel="alternate" hreflang="it-it" href="http://www.test.fr/15-mensola-porta-cd" /> <link rel="alternate" hreflang="en-us" href="http://www.test.fr/15-cd-wall-shelf" /> <link rel="XXX-TEST-canonical" href="http://www.test.fr/15-etageres-range-cd?n=180" /> Edited April 17, 2015 by hugolin69 (see edit history) Link to comment Share on other sites More sharing options...
ZiZuu Posted April 17, 2015 Share Posted April 17, 2015 (edited) Ops .. sorry forgot to push Meanwhile the patch has been merged in PS core .. will be available in next PS 1.6.1.0 going to push .. sorry Edited April 17, 2015 by ZiZuu (see edit history) Link to comment Share on other sites More sharing options...
ZiZuu Posted April 17, 2015 Share Posted April 17, 2015 be sure to clear every cache and delete classes_cache.php too 1 Link to comment Share on other sites More sharing options...
hugolin69 Posted April 17, 2015 Share Posted April 17, 2015 (edited) Sorry, I do not not where is the classes_cache.php, but I clear cache. Here is the debug, but with the last version, now, the whole URL stay in french (I am visiting the shop in French) As you can see in the debug, the [domain] are empty <link rel="XXX-debug-shop-id" value="1" /> <link rel="XXX-debug-shop" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test FRANCE [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 1 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="fr-fr" href="http://www.test.fr/12-etageres-murales" /> <link rel="XXX-debug-shop-id" value="4" /> <link rel="XXX-debug-shop" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ANGLAIS [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 4 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="en-gb" href="http://www.test.fr/12-etageres-murales" /> <link rel="XXX-debug-shop-id" value="5" /> <link rel="XXX-debug-shop" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ALLEMAND [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 5 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="de-de" href="http://www.test.fr/12-etageres-murales" /> <link rel="XXX-debug-shop-id" value="7" /> <link rel="XXX-debug-shop" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ITALIEN [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 7 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="it-it" href="http://www.test.fr/12-etageres-murales" /> <link rel="XXX-debug-shop-id" value="8" /> <link rel="XXX-debug-shop" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ESPAGNE [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 8 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="es-es" href="http://www.test.fr/12-etageres-murales" /> <link rel="XXX-debug-shop-id" value="9" /> <link rel="XXX-debug-shop" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test US [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 9 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="en-us" href="http://www.test.fr/12-etageres-murales" /> Edited April 17, 2015 by hugolin69 (see edit history) Link to comment Share on other sites More sharing options...
ZiZuu Posted April 17, 2015 Share Posted April 17, 2015 Uhmm ... the Shop Objects seems ok "Shop Object ( [id_shop_group] => 1[id_category] => 2[id_theme] => 2 [name] => test US" be sure to remove /cache/class_index.php (PS will regenerate it) Link to comment Share on other sites More sharing options...
hugolin69 Posted April 17, 2015 Share Posted April 17, 2015 I do not have this file in /cache at root. Is that normal we have nothing in this parameters in debug ? [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => Link to comment Share on other sites More sharing options...
hugolin69 Posted April 28, 2015 Share Posted April 28, 2015 You give up ? Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 Sorry, busy on other tasks .. I can't understand what is going wrong .. If you are sure every cache was cleared and the very last version is online the output is strange The classes cache file should be in PS_ROOT/cache/ .. in PS 1.6.0.14 it should be re-created if removed .. in PS 61.6.0.9 it isn't as for a bug .. I can't debug very easily without a testing server, sorry Link to comment Share on other sites More sharing options...
hugolin69 Posted April 29, 2015 Share Posted April 29, 2015 I am on 1.6. Maybe I should work manually with a regex to change the domain. Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 what's "1.6" ? Link to comment Share on other sites More sharing options...
hugolin69 Posted April 29, 2015 Share Posted April 29, 2015 Sorry, 1.6.0.9 is my version of Prestashop. I do not have /cache/class_index.php, just /cache/index.php Link to comment Share on other sites More sharing options...
hugolin69 Posted April 29, 2015 Share Posted April 29, 2015 (edited) Here is the new debug. As you can see, the domain still always the same, even the rest of the query is ok. For the class_index.php, I found why I do not have it: solution here The PrestaShopAutoload had a bug: const INDEX_FILE = 'cache/class_index.php'; have to be replaced with const INDEX_FILE = '/cache/class_index.php';. <link rel="XXX-default_lang" value="1" /> <link rel="XXX-default_shop" value="1" /> <link rel="XXX-shop-id" value="1" /> <link rel="XXX-shop-object" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test FRANCE [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 1 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="x-default" href="http://www.test.fr/20-etageres-bibliotheque" /> <link rel="alternate" hreflang="fr-fr" href="http://www.test.fr/20-etageres-bibliotheque" /> <link rel="XXX-shop-id" value="4" /> <link rel="XXX-shop-object" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ANGLAIS [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 4 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="en-gb" href="http://www.test.fr/20-bookshelves" /> <link rel="XXX-shop-id" value="5" /> <link rel="XXX-shop-object" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ALLEMAND [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 5 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="de-de" href="http://www.test.fr/20-bucherregal" /> <link rel="XXX-shop-id" value="7" /> <link rel="XXX-shop-object" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ITALIEN [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 7 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="it-it" href="http://www.test.fr/20-libreria" /> <link rel="XXX-shop-id" value="8" /> <link rel="XXX-shop-object" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test ESPAGNE [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 8 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="es-es" href="http://www.test.fr/20-biblioteca" /> <link rel="XXX-shop-id" value="9" /> <link rel="XXX-shop-object" value="Shop Object ( [id_shop_group] => 1 [id_category] => 2 [id_theme] => 2 [name] => test US [active] => 1 [deleted] => 0 [theme_name] => [theme_directory] => [physical_uri] => [virtual_uri] => [domain] => [domain_ssl] => [group:protected] => [webserviceParameters:protected] => Array ( [fields] => Array ( [id_shop_group] => Array ( [xlink_resource] => shop_groups ) [id_category] => Array ( ) [id_theme] => Array ( ) ) ) [id] => 9 [id_lang:protected] => [id_shop:protected] => [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => shop [identifier:protected] => id_shop [fieldsRequired:protected] => Array ( [0] => name [1] => id_theme [2] => id_category [3] => id_shop_group ) [fieldsSize:protected] => Array ( [name] => 64 ) [fieldsValidate:protected] => Array ( [active] => isBool [deleted] => isBool [name] => isGenericName ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => shop [primary] => id_shop [fields] => Array ( [active] => Array ( [type] => 2 [validate] => isBool ) [deleted] => Array ( [type] => 2 [validate] => isBool ) [name] => Array ( [type] => 3 [validate] => isGenericName [required] => 1 [size] => 64 ) [id_theme] => Array ( [type] => 1 [required] => 1 ) [id_category] => Array ( [type] => 1 [required] => 1 ) [id_shop_group] => Array ( [type] => 1 [required] => 1 ) ) [classname] => Shop ) [update_fields:protected] => [force_id] => ) 1" /> <link rel="alternate" hreflang="en-us" href="http://www.test.fr/20-bookshelves" /> <link rel="XXX-TEST-canonical" href="http://www.test.fr/20-etageres-bibliotheque?n=180" /> Edited April 29, 2015 by hugolin69 (see edit history) Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 In the actual shop domain and URIs properties are valorised .. the problem is here .. Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 Please try the actual code ... it should be ok ... hopefully Link to comment Share on other sites More sharing options...
hugolin69 Posted April 29, 2015 Share Posted April 29, 2015 No, it is not... :-( But now, the debug fill in the domain and domain_ssl.... What I did, with an horrible hack, is looking for the domain, and passing it to the smarty. I don't understand why we have the context, and still using the domain of the open shop. I would prefer to find an clean solution, but seems not so easy. $actual_domain = $this->context->shop->domain; foreach (Shop::getShopsCollection(true) as $shop) { //Get URL SHOP $my_shop = new Shop(); $my_shop->id = $shop->id; $my_shop->setUrl(); $shop_context = $this->context->cloneContext(); $shop->setUrl(); $shop_context->shop = $shop; $shops_data[$shop->id] = array( 'context' => $shop_context, 'languages' => Language::getLanguages(true, $shop->id), 'my_domain' => $my_shop->domain ); unset($my_shop); } <link rel="alternate" hreflang="{$lang.language_code}" href="{$url|replace:$actual_domain:$shop_data.my_domain|escape:html}" /> Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 just another try .. plz make sure you ave the Link.php patched with the following: --- ./classes/Link.php.orig 2015-04-17 09:46:19.519206473 +0200 +++ ./classes/Link.php 2015-04-17 09:53:51.783984770 +0200 [spam-filter] -486,8 +486,8 [spam-filter] $controller = Dispatcher::getInstance()->getController(); - if (!empty(Context::getContext()->controller->php_self)) - $controller = Context::getContext()->controller->php_self; + if (!empty($context->controller->php_self)) + $controller = $context->controller->php_self; if ($controller == 'product' && isset($params['id_product'])) return $this->getProductLink((int)$params['id_product'], null, null, null, (int)$id_lang); If not already patched patch it and purge your classes_index.php file Link to comment Share on other sites More sharing options...
hugolin69 Posted April 29, 2015 Share Posted April 29, 2015 This file has been patch before, seems to be the same patch. if (!empty($context->controller->php_self)){ $controller = $context->controller->php_self; } 1 Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 I think to have fond the root problem .. maybe it's another PS bug .. stay tuned Link to comment Share on other sites More sharing options...
ZiZuu Posted April 29, 2015 Share Posted April 29, 2015 (edited) Ok .. now the Link class should be aware of the context Please apply the following patch (over the previous one), remove the cache file --- ../../classes/Link.php.orig2 2015-04-29 19:02:16.763338392 +0200 +++ ../../classes/Link.php 2015-04-29 19:14:15.682129361 +0200 [spam-filter] -486,33 +486,35 [spam-filter] unset($params['id_lang']); $controller = Dispatcher::getInstance()->getController(); + + $id_shop = (int)$context->shop->id; if (!empty($context->controller->php_self)) $controller = $context->controller->php_self; if ($controller == 'product' && isset($params['id_product'])) - return $this->getProductLink((int)$params['id_product'], null, null, null, (int)$id_lang); + return $this->getProductLink((int)$params['id_product'], null, null, null, (int)$id_lang, $id_shop); elseif ($controller == 'category' && isset($params['id_category'])) - return $this->getCategoryLink((int)$params['id_category'], null, (int)$id_lang); + return $this->getCategoryLink((int)$params['id_category'], null, (int)$id_lang, $id_shop); elseif ($controller == 'supplier' && isset($params['id_supplier'])) - return $this->getSupplierLink((int)$params['id_supplier'], null, (int)$id_lang); + return $this->getSupplierLink((int)$params['id_supplier'], null, (int)$id_lang, $id_shop); elseif ($controller == 'manufacturer' && isset($params['id_manufacturer'])) - return $this->getManufacturerLink((int)$params['id_manufacturer'], null, (int)$id_lang); + return $this->getManufacturerLink((int)$params['id_manufacturer'], null, (int)$id_lang, $id_shop); elseif ($controller == 'cms' && isset($params['id_cms'])) - return $this->getCMSLink((int)$params['id_cms'], null, null, (int)$id_lang); + return $this->getCMSLink((int)$params['id_cms'], null, null, (int)$id_lang, $id_shop); elseif ($controller == 'cms' && isset($params['id_cms_category'])) - return $this->getCMSCategoryLink((int)$params['id_cms_category'], null, (int)$id_lang); + return $this->getCMSCategoryLink((int)$params['id_cms_category'], null, (int)$id_lang, $id_shop); elseif (isset($params['fc']) && $params['fc'] == 'module') { $module = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : ''; if (!empty($module)) { unset($params['fc'], $params['module']); - return $this->getModuleLink($module, $controller, $params, null, (int)$id_lang); + return $this->getModuleLink($module, $controller, $params, null, (int)$id_lang, $id_shop); } } - return $this->getPageLink($controller, null, $id_lang, $params); + return $this->getPageLink($controller, null, $id_lang, $params, false, $id_shop); } public function goPage($url, $p) Edited May 4, 2015 by ZiZuu (see edit history) Link to comment Share on other sites More sharing options...
ZiZuu Posted May 4, 2015 Share Posted May 4, 2015 Please let me know if it fix ASAP Link to comment Share on other sites More sharing options...
hugolin69 Posted May 4, 2015 Share Posted May 4, 2015 Sorry for delay. I just applied the patch, giving the id_shop. (Please note you have a bug in your zzseotk.php in line 201, it should be $shops_data[$shop_id] not $shops_data[$shop->id] But still have the same domain name, and strangely at the end of the furl, the number of the shop like http://www.test.fr/12-etageres-murales/4 (for Shop 4) Link to comment Share on other sites More sharing options...
ZiZuu Posted May 4, 2015 Share Posted May 4, 2015 I'm going crazy on this issue Link to comment Share on other sites More sharing options...
hugolin69 Posted May 4, 2015 Share Posted May 4, 2015 With my craspy code, I solve the problem by replacing the domain. I know this is not clean, but it's working for now. Thank you for your help. 1 Link to comment Share on other sites More sharing options...
Chrisi1321 Posted May 18, 2015 Share Posted May 18, 2015 (edited) @zizuu I used your module, but unfortunately it produces wrong urls (PS. 1.6.0.13): <link rel="alternate" hreflang="de-at" href="https://www.aktiv-naturheilmittel.at"/><link rel="alternate" hreflang="de-de" href="https://www.aktiv-naturheilmittel.at"/><link rel="alternate" hreflang="de-ch" href="https://www.aktiv-naturheilmittel.at"/><link rel="XXX-TEST-canonical" href="https://www.aktiv-naturheilmittel.at/"/> but it should be like this : <link rel="alternate" hreflang="de-at" href="https://www.aktiv-naturheilmittel.at"/><link rel="alternate" hreflang="de-de" href="https://www.aktiv-naturheilmittel.de"/><link rel="alternate" hreflang="de-ch" href="https://www.aktiv-naturheilmittel.ch"/><link rel="XXX-TEST-canonical" href="https://www.aktiv-naturheilmittel.at/"/> Edited May 18, 2015 by Chrisi1321 (see edit history) Link to comment Share on other sites More sharing options...
hugolin69 Posted May 20, 2015 Share Posted May 20, 2015 Here is what I did. In the PHP file, to contruct the $liste_shop = Shop::getShopsCollection(true); foreach ($liste_shop as $shop) { switch($shop->id){ case 1: $label = "Français"; $id_lang = 3; $code_langue = "fr-fr"; $code_court_langue = "fr"; break; case 4: $label = "English GB"; $id_lang = 3; $code_langue = "en-gb"; $code_court_langue = "gb"; break; case 5: $label = "Deutsch"; $id_lang = 2; $code_langue = "de-de"; $code_court_langue = "de"; break; case 7: $label = "Italiano"; $id_lang = 5; $code_langue = "it-it"; $code_court_langue = "it"; break; case 8: $label = "Español"; $id_lang = 4; $code_langue = "es-es"; $code_court_langue = "es"; break; case 9: $label = "English US"; $id_lang = 6; $code_langue = "en-us"; $code_court_langue = "en"; break; } //Get URL SHOP $my_shop = new Shop(); $my_shop->id = $shop->id; $my_shop->setUrl(); $shop_context = $this->context->cloneContext(); $shop->setUrl(); $shop_context->shop = $shop; $shops_data[$shop->id] = array( 'id_lang' => $id_lang ,'id_shop' => $shop->id ,'code_langue' => $code_langue ,'label' => $label ,'code_court_langue' => $code_court_langue ,'context' => $shop_context ,'languages' => Language::getLanguages(true, $shop->id) ,'my_domain' => $my_shop->domain ); unset($my_shop); } $actual_domain = $this->context->shop->domain; $smarty->assign(array( 'qs' => $qs, 'shops_data' => $shops_data, 'default_lang' => (int)Configuration::get('PS_LANG_DEFAULT'), 'default_shop' => (int)Configuration::get('PS_SHOP_DEFAULT'), 'actual_domain' => $actual_domain )); In the TPL {foreach from=$shops_data item=shop_data key=shop_id} {assign 'url' $link->getLanguageLink($lang.id_lang, $shop_data.context)|regex_replace:'/\?.*$/':''} {if $url} <link rel="alternate" hreflang="{$lang.language_code}" href="{$url|replace:$actual_domain:$shop_data.my_domain|escape:html}{$qs|escape:html:'UTF-8'}" /> {/if} {/foreach} {/foreach} Not very clean, but it works. Link to comment Share on other sites More sharing options...
ZiZuu Posted May 21, 2015 Share Posted May 21, 2015 @zizuu I used your module, but unfortunately it produces wrong urls (PS. 1.6.0.13): <link rel="alternate" hreflang="de-at" href="https://www.aktiv-naturheilmittel.at"/><link rel="alternate" hreflang="de-de" href="https://www.aktiv-naturheilmittel.at"/><link rel="alternate" hreflang="de-ch" href="https://www.aktiv-naturheilmittel.at"/><link rel="XXX-TEST-canonical" href="https://www.aktiv-naturheilmittel.at/"/> but it should be like this : <link rel="alternate" hreflang="de-at" href="https://www.aktiv-naturheilmittel.at"/><link rel="alternate" hreflang="de-de" href="https://www.aktiv-naturheilmittel.de"/><link rel="alternate" hreflang="de-ch" href="https://www.aktiv-naturheilmittel.ch"/><link rel="XXX-TEST-canonical" href="https://www.aktiv-naturheilmittel.at/"/> There is an Issue opened about this .. sorry, it's hard to solve in a clean way https://github.com/ZiZuu-store/PrestaShop_module-zzSEOtk/issues/1 Link to comment Share on other sites More sharing options...
ZiZuu Posted May 21, 2015 Share Posted May 21, 2015 (edited) Please report everything about this hreflang issue on zzSEOtk module in the opened an issue https://github.com/ZiZuu-store/PrestaShop_module-zzSEOtk/issues/1 The actual dev release should implement @ugolin69 "dirty" fix ... hope it could work while attempting to have "the" solution Edited May 21, 2015 by ZiZuu (see edit history) Link to comment Share on other sites More sharing options...
Chrisi1321 Posted May 21, 2015 Share Posted May 21, 2015 I don't know why, but when I try to install the module in backoffice it says module upload succesfull but it doesn't show up in the list to install it. When I try to copy the directory into the module folder by ftp it also doesn't show up in backoffice. Any suggestions? Link to comment Share on other sites More sharing options...
mlarino Posted May 27, 2015 Share Posted May 27, 2015 Hello, I implemented the hreflang in the header, and it is working perfect for every page except for the manufacturer list page and manufacturer pages, I am using this code, does someone see any issues with it? {if $page_name == 'manufacturer'} <link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, null, null, $id_lang, null, 0, false)}" /> {foreach $languages as $lang} <link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, null, null, $lang.id_lang, null, 0, false)}" /> {/foreach} {/if} Link to comment Share on other sites More sharing options...
anriuz Posted June 9, 2015 Share Posted June 9, 2015 Guys, why not just use the sitemap files in desired languages instead of creating and fixing modules? Link to comment Share on other sites More sharing options...
mlarino Posted June 9, 2015 Share Posted June 9, 2015 Guys, why not just use the sitemap files in desired languages instead of creating and fixing modules? The sitemap doesnt give google the info of what page is the "alternate" in another language. ---- OK, I have all hreflangs working for every page, but some how Prestashop has an issue with manufacturer list pages. manufacturer pages work ok, but not the manufaturers list. I get this: <link rel="alternate" hreflang="en" href="http://www.shop.com/en/brands/-"> <link rel="alternate" hreflang="es-es" href="http://www.shop.com/es/brands/-"> instead of: <link rel="alternate" hreflang="en" href="http://www.shop.com/en/brands"> <link rel="alternate" hreflang="es-es" href="http://www.shop.com/es/brands"> Its adding "/-" at the end of the URL in the manufacturers list page. Why does Prestashop do that? any solution? thanks Link to comment Share on other sites More sharing options...
xfdisco Posted August 10, 2015 Share Posted August 10, 2015 @peorthyr: Many thanks for your module! We're currently testing. The module works well but we have another problem. We import CSV data from our ERP system in prestashop everday. When we use your module English friendly URLs are German or reverse. I couldn't figure out how I can control it. I tried to delete alle articles before import to reset all URLs but it didn't help. Do you have an idea how to solve the problem? Is there a way to reset or rewrite all article URLs? Link to comment Share on other sites More sharing options...
ZiZuu Posted August 11, 2015 Share Posted August 11, 2015 (edited) @xfdisco give a try to https://github.com/ZiZuu-store/PrestaShop_module-zzSEOtk/releases/latest Edited August 11, 2015 by ZiZuu (see edit history) Link to comment Share on other sites More sharing options...
xfdisco Posted August 12, 2015 Share Posted August 12, 2015 Is it stable now? 1 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