Remove hash with attributes from URL in PrestaShop 1.7

my urls to product pages has weird hash after url that has informations about attrbutes, for example:
how i can remove the part #/3-color-red/36-size-m/42-stan-bardzo_dobry_5_6 ?

Expert answer 

This part of url contains information about combination, so when you will access to product page prestashop will automatically select attributes defined in the url. 

If you want to remove it, you will need to modify the prestashop's core or use a module pretty urls (it removes hash with attributes, id product and also id product attrbute from url).

Modification of core
if you want to just remove the hash with attributes info you need to modify the Link.php class that is available in directory classes/Link.php

there is a function that builds urls to product pages:
public function getProductLink(    $product,    $alias = null,    $category = null,    $ean13 = null,    $idLang = null,    $idShop = null,    $ipa = 0,    $force_routes = false,    $relativeProtocol = false,    $addAnchor = false,    $extraParams = array()
){    ...}

inside this function you can find code like (somewhere near line 221)
$anchor = $ipa ? $product->getAnchor((int) $ipa, (bool) $addAnchor) : '';

modify it to:

$anchor = '';

Share on Google Plus


This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment


  1. It works great. If I wanted to remove a category or subcategory and product ID from product url, how do I edit it?
    From: https://example/long-sleeve/5268-13168-top-with-long-sleeves.html
    To: https://example/top-with-long-sleeves.html

    1. hello
      go to preferences > traffic (prestashop 1.7)
      go to preferences > seo & urls (prestashop 1.6)

      there is a section to manage "schema of urls"
      change the schema for "product pages" from: {category:/}{rewrite}.html to:{rewrite}.html

  2. Hi

    You simply replace the line 220 of the file classes / link.php:
    $ anchor = $ ipa? $ product-> getAnchor ((int) $ ipa, (bool) $ addAnchor): '';


    $ anchor = '';

    clear cache

    example url:


    is that all it takes? and it works?
    thank you

    1. I am affraid that with this method the attribute swich on product page will not work correctly, but of course case requires verification