Forked from splendidinternet/magento-ce-1.9.1.0-swatchfix.patch
Created
April 4, 2016 13:04
-
-
Save wienczny/28f891f6861112a5e6d40cfa0e24c6a4 to your computer and use it in GitHub Desktop.
Patch for Magento 1.9.1.0 swatches image swap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment