Jump to content

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)
Link to comment
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 2
Link to comment
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
Link to comment
Share on other sites

  • 3 weeks later...

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)
Link to comment
Share on other sites

  • 1 month later...

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

  • 2 weeks later...

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

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

  • 3 weeks later...

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

  • 2 weeks later...
  • 1 month later...
  • 5 weeks later...

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)
Link to comment
Share on other sites

  • 3 weeks later...

 

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)
Link to comment
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)
Link to comment
Share on other sites

  • 2 weeks later...

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

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
Link to comment
Share on other sites

  • 3 weeks later...

 

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

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
Link to comment
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...

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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

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

  • 3 weeks later...
  • 3 weeks later...
  • 3 weeks later...

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

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
Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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 )

Link to comment
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.

Link to comment
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

Link to comment
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 ?

Link to comment
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
Link to comment
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)
Link to comment
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)
Link to comment
Share on other sites

  • 2 weeks later...

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

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)
Link to comment
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}" />
Link to comment
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

Link to comment
Share on other sites

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 by ZiZuu (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

@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 by Chrisi1321 (see edit history)
Link to comment
Share on other sites

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

 

@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

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

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

  • 2 weeks later...

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

  • 2 months later...

@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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...