Jump to content
thirty bees forum

Removing attribute id from url anchor


dotray

Recommended Posts

I'm not looking to remove the whole anchor; just the number id but I can't seem to find where is the relevant piece of code to modify.
I found this but fiddling around with it leads me nowhere; taking out the group/name also does nothing.  I cleared cache between updates.
https://github.com/thirtybees/thirtybees/blob/eb61447487d82db27522e0613890bf4094b0af8e/classes/Product.php#L7603

Link to comment
Share on other sites

11 hours ago, wakabayashi said:

Isn't that the normal behaviour?

I am the owner of chesspoint.ch. I changed some things with attributes, since I don't want to have any "default" attribute. But I can't remember, that I removed the id in the url 😮 

I don't think it's default.  Trying out my 1.0.8/BE instances and both have the id in the anchor.  Same with the website demo.
 

Link to comment
Share on other sites

11 hours ago, wakabayashi said:

I looked a bit into it. It seems to be theme related...

You would need to edit product.js in your theme. There the function getProductAttribute(). But I am really not sure if this is worth it...

I've been a busy 🐝 imbibed on "nectar" & "sweets" and figured it out.  Selecting/adding the product looks fine so far.

in function getProductAttribute()

https://github.com/thirtybees/community-theme-default/blob/30a27a8976f87917323a90e1bd43933398cd65fb/js/product.js#L1075

 

request += '/' + attributesCombinations[i]['id_attribute'] + '-' + attributesCombinations[i]['group'] + attribute_anchor_separator + attributesCombinations[i]['attribute'];

to

request += '/' + attributesCombinations[i]['group'] + attribute_anchor_separator + attributesCombinations[i]['attribute'];

in function checkUrl()

https://github.com/thirtybees/community-theme-default/blob/30a27a8976f87917323a90e1bd43933398cd65fb/js/product.js#L1131

 if (attributesCombinations[a]['group'] === decodeURIComponent(tabValues[z][1]) &&
              attributesCombinations[a]['id_attribute'] === decodeURIComponent(tabValues[z][0])) {
              count++;

to

if (attributesCombinations[a]['group'] === decodeURIComponent(tabValues[z][0]) &&
              attributesCombinations[a]['attribute'] === decodeURIComponent(tabValues[z][1])) {
              count++;

 

Also commenting out "window.location.replace(url + request);" removes the anchor completely.

 

Link to comment
Share on other sites

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