Remove hash with attributes from URL in PrestaShop 1.7

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

About VEKIA

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

0 comments:

Post a Comment