Jump to content
peorthyr

hreflang and canonical links creation on prestashop 1.6

Recommended Posts

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 by peorthyr (see edit history)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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 by peorthyr (see edit history)
  • Like 7

Share this post


Link to post
Share on other sites

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 by mark-b (see edit history)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Great work Peorthyr. I installed your module on PS 1.5.6. and seems to work well too.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

thanks for your answer,

 

I wanted to avoid creating new language because I do not trust that errors may appear on this process

Share this post


Link to post
Share on other sites

Nice module. Would like to know or it compatible with multistore function when i use different domain names for different languages?

 

Thanks,

R25

Share this post


Link to post
Share on other sites

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 by HaCos (see edit history)

Share this post


Link to post
Share on other sites

 

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 by the.rampage.rado (see edit history)

Share this post


Link to post
Share on other sites

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/

Share this post


Link to post
Share on other sites

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 by mark-b (see edit history)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 by juvelin (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

 

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?

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi Peorthyr,

 

Thank you for your reply, and sorry for the mispelling on your pseudo.

 

 

Grazie mille :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Hi peorthyr,

 

I don't seem to be able to download the module from your site, is it still available?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Edited by Tommix (see edit history)

Share this post


Link to post
Share on other sites

Hi, download link is still down :(

 

Can someone share the module please ?

Share this post


Link to post
Share on other sites

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 :rolleyes:

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by ZiZuu (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by ZiZuu (see edit history)

Share this post


Link to post
Share on other sites

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 by hugolin69 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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 )

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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
  • Like 1

Share this post


Link to post
Share on other sites

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 by hugolin69 (see edit history)

Share this post


Link to post
Share on other sites

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 by ZiZuu (see edit history)

Share this post


Link to post
Share on other sites

be sure to clear every cache and delete classes_cache.php too

  • Like 1

Share this post


Link to post
Share on other sites

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 by hugolin69 (see edit history)

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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] => 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

I am on 1.6.

 

Maybe I should work manually with a regex to change the domain.

Share this post


Link to post
Share on other sites

Sorry, 1.6.0.9 is my version of Prestashop.

 

I do not have /cache/class_index.php, just /cache/index.php

Share this post


Link to post
Share on other sites

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 by hugolin69 (see edit history)

Share this post


Link to post
Share on other sites

In the actual shop domain and URIs properties are valorised .. the problem is here ..

Share this post


Link to post
Share on other sites

Please try the actual code ... it should be ok ... hopefully 

Share this post


Link to post
Share on other sites

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}" />

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

This file has been patch before, seems to be the same patch.

 

if (!empty($context->controller->php_self)){
            $controller = $context->controller->php_self;
            
        }

  • Like 1

Share this post


Link to post
Share on other sites