spree/spree — pull request #3907 by renechz (2013-10-24 01:01:04+00:00)
Title: Make product variants thumbnails selection more specific in product.js.coffee

Just ran into this issue today.

In my `products#show` view I display the similar/related products using thumbnails and added the `.thumbnails` class for styling consistency. So my view has two `ul.thumbnails` elements, but when a product has variants and the variants don't have thumbnails (i.e. the `#product-images ul.thumbnails` element doesn't exist) the `Spree.showVariantImages` function is applied to the similar products `ul.thumbnails` element and doesn't work as expected. Does that make sense?

Making the JS selector specific to the `#product-images` section resolves that.

I believe the `#product-images ul.thumbnails` selector in `Spree.showVariantImages` could also be moved to a variable like in `addImageHandlers`.