Jump to content

Edit History

need2011

need2011

On 5/20/2019 at 10:38 AM, WebDesign-Entreprise said:

Hello,

Actually everything is ok because PS17 generates canonical url in the head part. So Google knows that /en/women/2-10-brown-bear-printed-sweater.html#/2-size-m is just another page of /en/women/2-brown-bear-printed-sweater.html

You can see more infos here: https://support.google.com/webmasters/answer/139066?hl=en

The bad thing is that canonical url (/en/women/2-brown-bear-printed-sweater.html) is redirected with 301 or 302 code to default attribute product page. This is very bad because you say two differents informations to Google.

The PS1.7.6 will correct this point (https://github.com/PrestaShop/PrestaShop/pull/13009)

In controllers/front/ProductController.php replace line 55 with:


 public function canonicalRedirection($canonical_url = '')
    {
        if (Validate::isLoadedObject($this->product)) {
            if (!$this->product->hasCombinations() ||
                !$this->isValidCombination(Tools::getValue('id_product_attribute'), $this->product->id)) {
                //Invalid combination we redirect to the canonical url (with attribute id)
                unset($_GET['id_product_attribute']);
            } else {
                //Only redirect to canonical (parent product without combination) when the requested combination is not valid
                //In this case we are in a valid combination url and we must display it with redirection for SEO purpose
                return;
            }
            //Note: we NEED these 6 arguments to have $ipa=null or else a parameter will be added
            //id_product_attribute=0 and force the redirection
            parent::canonicalRedirection($this->context->link->getProductLink(
                $this->product,
                null,
                null,
                null,
                null,
                null,
                null
            ));
        }
    }

I think now the situation is ok.

You can test here: https://www.anakiss.fr/chaussons-en-laine-pour-bebe/11-chaussons-hauts.html

Olivier

I tried it in 1.7.4.4 and it did not work all product pages were blank.  1.7.6 is not available now is there any way you can get this to work in 1.7.4.4?  I've got duplicate pages on all my products.  Thanks for any help you can give.

need2011

need2011

On 5/20/2019 at 10:38 AM, WebDesign-Entreprise said:

Hello,

Actually everything is ok because PS17 generates canonical url in the head part. So Google knows that /en/women/2-10-brown-bear-printed-sweater.html#/2-size-m is just another page of /en/women/2-brown-bear-printed-sweater.html

You can see more infos here: https://support.google.com/webmasters/answer/139066?hl=en

The bad thing is that canonical url (/en/women/2-brown-bear-printed-sweater.html) is redirected with 301 or 302 code to default attribute product page. This is very bad because you say two differents informations to Google.

The PS1.7.6 will correct this point (https://github.com/PrestaShop/PrestaShop/pull/13009)

In controllers/front/ProductController.php replace line 55 with:


 public function canonicalRedirection($canonical_url = '')
    {
        if (Validate::isLoadedObject($this->product)) {
            if (!$this->product->hasCombinations() ||
                !$this->isValidCombination(Tools::getValue('id_product_attribute'), $this->product->id)) {
                //Invalid combination we redirect to the canonical url (with attribute id)
                unset($_GET['id_product_attribute']);
            } else {
                //Only redirect to canonical (parent product without combination) when the requested combination is not valid
                //In this case we are in a valid combination url and we must display it with redirection for SEO purpose
                return;
            }
            //Note: we NEED these 6 arguments to have $ipa=null or else a parameter will be added
            //id_product_attribute=0 and force the redirection
            parent::canonicalRedirection($this->context->link->getProductLink(
                $this->product,
                null,
                null,
                null,
                null,
                null,
                null
            ));
        }
    }

I think now the situation is ok.

You can test here: https://www.anakiss.fr/chaussons-en-laine-pour-bebe/11-chaussons-hauts.html

Olivier

I tried it in 1.7.4.4 and it did not work all product pages were blank.  1.7.6 is not available now is there any way you can get this to work in 1.7.4.4?  I've got duplicate pages on all my products.

×
×
  • Create New...