Hello
my urls to product pages has weird hash after url that has informations about attrbutes, for example:
domain.com/t-shirt/1-1-red-shirt.html#/3-color-red/36-size-m/42-stan-bardzo_dobry_5_6
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:
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 = '';
It works great. If I wanted to remove a category or subcategory and product ID from product url, how do I edit it?
ReplyDeleteFrom: https://example/long-sleeve/5268-13168-top-with-long-sleeves.html
To: https://example/top-with-long-sleeves.html
hello
Deletego 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