Rich-text Reply

Need to change add to cart image across multiple pages

atxwebdesigner1 02-04-15

Need to change add to cart image across multiple pages

 

I have optimizely snippet on all pages. I have setup my experiment to run across all intended pages.

 

 Placing a couple of product pages:

http://www.sportsjerseyscanada.ca/en/montreal-canadiens-jersey-7185105CC.html

http://www.sportsjerseyscanada.ca/en/toronto-maple-leafs-jersey-7185104T.html

 

In the optimizely editor I got one of the product page URL. I changed the add to cart button. In the URL target I listed all product page URL's.

 

Problem is other product page URL's dont have Add to Cart images changed.

 

Is this because each add to cart tag has a different id for each page.

 

I got stuck. Any help is appreciated

Joel_Balmer 02-04-15
 

Re: Need to change add to cart image across multiple pages

Hi there!

 

This looks like a common problem where the edit finds an ID, which is great for this page, but when the element IDs are product IDs, or dynamically generated, or different across pages, you will need to account for this.

 

From your page, it looks like you can use the class instead to target the same elements, like so:

 

$(".cm-submit-link > img")

This means you can make whatever changes you want to make in the editor, let the editor 'do the work' and generate the code, then once finished you can edit the selector to, instead of $("#button_cart..."), etc., just replace it with the above code.

 

I hope that helps!