Jump to content

How to remove attribute and values from the URL?


Recommended Posts

How can I avoid that the product attributes get pushed at the end of the URL as soon as I select a product option?

 

Example:

myshop.com/presta/music-ipods/1-ipod-nano.html

becomes:

myshop.com/presta/music-ipods/1-ipod-nano.html#/disk_space-8gb/color-black

 

If I look at the official PrestaShop demo shop, I can see that it doesn't happen there (e.g. http://demo-store.pr...28-handbag.html)

 

Is there a built-in way to have that kind of behavior or do I need to buy a module for that?

Edited by leeego (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

REALLY wanna know too, but it looks like the demoshop loose the ability to link to a product, exactly as the customer purchased

 

Example, if you click at the link in the cart at the demoshop or in the orderconfirm email, the preselected choice are gone...

Maybe it will confuse and scare customers and wondering if they purchased the correct model ???

 

Example in one of my shops:

http://www.living-in-harmony.dk/12-spisebord-langbord-harmony.html#/bord_harmony_samling_bentype-hjoslashrnesamling_b_traeligben_12_x_12_cm/bord_str_harmony-100_x_220_cm/bord_till%C3%A6gsplader-2_stk_tillaeliggsplader

 

But surely an ugly URL and annoying for "browser-back" navigation, should be solved without loosing EXACT links as well

Link to comment
Share on other sites

If you have a lot of options per product, it may make sense to put all the parameters to the URL, yes. But in my case there is only two attributes with each three values. So i wouldn't mind if the user has to reselect his options.

 

So the fact that the user has to click the back button multiple times to actually get back to where he wants, has much more impact to my shop.

 

If you one would want short URLs and the one click back button it could be probably solved with a cookie, but I'm not experienced enough with PrestaShop to say that this is the way to go.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Hello Seirei

 

Sadly, I didn't get any answer so far. It would be cool if someone from PrestaShop could tell us, if they use an addon in their demo store to get the desired results, or if it's already built into PrestaShop.

Link to comment
Share on other sites

file product.js > function getProductAttribute()

 

Search, remove or comment following lines (comment the lines by adding "//" without quotes)

    for (var i in attributesCombinations)
        for (var a in tab_attributes)
            if (attributesCombinations[i]['id_attribute'] === tab_attributes[a])
                request += '/'+attributesCombinations[i]['group'] + '-' + attributesCombinations[i]['attribute'];
    request = request.replace(request.substring(0, 1), '#/');

AND this line to prevent page reloading

window.location = url + request;

... don't know what would be affected then ...

 

  • Like 1
Link to comment
Share on other sites

Hmm, this seems to break product combinations: If e.g. a product has two attributes (color and size), only the selected value of the first attribute (color) will be correctly taken to the cart. The value of the second attribute (size) falls back to its default value.

 

I don't know if this is related to my shop as I did some customization in that part. Can anyone else confirm this problem?

Edited by leeego (see edit history)
Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...

this solution dont works in my 1.5.6, I can solve the problem comment this lines:

 

// build new request
/*for (var i in attributesCombinations)
for (var a in tab_attributes)
if (attributesCombinations['id_attribute'] === tab_attributes[a])
request += '/'+attributesCombinations['group'] + '-' + attributesCombinations['attribute'];*/
request = request.replace(request.substring(0, 1), '#/'); ----> if you delete this line you can't make the request and the button add to cart don't works.
url = window.location + '';
Link to comment
Share on other sites

It actually isn't a bug, its a feature. Search Engines ignore an anchor tag, everything after one of these #

 

The actual url that is indexed by Google or Bing is the default product url. We see multiple addresses but spiders only see one unique url because the anchor text is ignored. Everything after the # tag needs a browser to make it useful. It is the browser software that uses the anchor for matching up to specific content. It is fantastic to send a link to a customer that shows them the exact color and size they wanted to see.

Link to comment
Share on other sites

  • 1 year later...

We sell cable products, each cable product has approx 30 'Length' Combinations to choose from.  We list these products in Google Merchant Center (Google Shopping) with each Combination its own product.  A valid Google Shopping listing requires a link back to a page that shows that product at the same price as what it's listed at in Google. The "#/" feature in PrestaShop product links work great (i.e., domain.com/category/main-product#/length-4_meter).  It links to the product and selects the combination automatically so the right price and product are displayed.

 
However, 1 problem exists with PrestaShop's "#/" anchor tag feature... Google Merchant accepts it in the XML upload, but Google Search doesn't index the 'Length' combinations because it thinks they are Anchor links not Page links.  Only the cables main product is indexed and it's not a product by itself, it needs a Length... so Google Merchant randomly selects one of the 30 lengths to display in Google Shopping.  Google support tried to figure it out and found nothing wrong with my listing or XML, their official response was 'Spend more in AdWords and more lengths will appear'... Code for they have no clue.  
 
Can someone with epic knowledge of PrestaShop confirm I can just remove "#" from "#/" in the snippet of product.js code below (theme/js/product.js) and clear my cache? 
	// build new request
	for (var i in attributesCombinations)
		for (var a in tab_attributes)
			if (attributesCombinations[i]['id_attribute'] === tab_attributes[a])
				request += '/'+attributesCombinations[i]['group'] + attribute_anchor_separator + attributesCombinations[i]['attribute'];
	request = request.replace(request.substring(0, 1), '#/');
	url = window.location + ''; 

Thanks in advance! 

Edited by rolinb (see edit history)
Link to comment
Share on other sites

  • 3 months later...

Hello, sorry to open this post, but please and i have exactly the same issue than Leego :

 

How avoid attributes get pushed at the end of my URL as soon as I select a product option because when the user has to click the back button mutilple time to delete this attributes choice.

 

Please help me I use PS 1.6.0.9

 

 

 

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

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