Last active
June 22, 2018 05:58
-
-
Save Stasevi4/d991f541e117301e070cd7eb0d4ffffc to your computer and use it in GitHub Desktop.
Magento Fix Undefined index - app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php on line 145
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/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php b/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php | |
index 13e8659..f7000df 100755 | |
--- a/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php | |
+++ b/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php | |
@@ -141,12 +141,12 @@ class Mage_ConfigurableSwatches_Helper_Productimg extends Mage_Core_Helper_Abstr | |
$swatchLabel = $label . self::SWATCH_LABEL_SUFFIX; | |
$imageKeys[$label] = array_search($label, $imageHaystack); | |
- if ($imageKeys[$label] === false) { | |
+ if ($imageKeys[$label] === false && array_keys($mapping, $label)) { | |
$imageKeys[$label] = array_search($mapping[$label]['default_label'], $imageHaystack); | |
} | |
$imageKeys[$swatchLabel] = array_search($swatchLabel, $imageHaystack); | |
- if ($imageKeys[$swatchLabel] === false) { | |
+ if ($imageKeys[$swatchLabel] === false && array_keys($mapping, $label)) { | |
$imageKeys[$swatchLabel] = array_search( | |
$mapping[$label]['default_label'] . self::SWATCH_LABEL_SUFFIX, $imageHaystack | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment