Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for Magento 1.9.1.0 swatches image swap
diff --git a/skin/frontend/rwd/default/js/configurableswatches/product-media.js b/skin/frontend/rwd/default/js/configurableswatches/product-media.js
index 17fd81f..5726200 100644
--- a/skin/frontend/rwd/default/js/configurableswatches/product-media.js
+++ b/skin/frontend/rwd/default/js/configurableswatches/product-media.js
@@ -65,8 +65,11 @@ var ConfigurableMediaImages = {
});
});
+ compatibleProducts.sort();
+
//intersect compatible products
compatibleProductSets.each(function(productSet) {
+ productSet.sort();
compatibleProducts = ConfigurableMediaImages.arrayIntersect(compatibleProducts, productSet);
});
@@ -107,6 +110,7 @@ var ConfigurableMediaImages = {
if(image) { //configurable product has image in the first place
//if intersection between compatible products and this label's products, we found a match
+ products.sort();
var isCompatibleProduct = ConfigurableMediaImages.arrayIntersect(products, compatibleProducts).length > 0;
if(isCompatibleProduct) {
return image;
@@ -120,7 +124,7 @@ var ConfigurableMediaImages = {
compatibleProducts.each(function(productId) {
if(childProductImages[productId] && ConfigurableMediaImages.isValidImage(childProductImages[productId])) {
childSwatchImage = childProductImages[productId];
- return false; //break "loop"
+ throw $break; //break "loop"
}
});
if (childSwatchImage) {
@namrodbui

This comment has been minimized.

Copy link

@namrodbui namrodbui commented Jun 29, 2015

I LOVE YOU.

@gmcn

This comment has been minimized.

Copy link

@gmcn gmcn commented Apr 5, 2017

me too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment