-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out of Stock associated product but its color swatch appears as product image #1694
Comments
I'm taking this issue. |
I have identified the problem and tried multiple fixes that work, but I'm not sure yet which one is appropriate and will not cause side effects. In magento-lts/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php Lines 109 to 146 in 17128ba
It is then getting used by magento-lts/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php Lines 332 to 358 in 17128ba
The easiest solution that will work is to add a condition to check if the image label resembles a swatch like so: if (preg_match('/.+'.self::SWATCH_LABEL_SUFFIX.'$/', $image->getLabel())) {
// This is a swatch image, do not show it
return false;
} But then this will not work if the image label is is named after the color name directly without the '-swatch' suffix |
Here are the steps to reproduce this issue.
Create a Configurable Product based on Color attribute which has in my case 2 defined values Blue and Grey.
In Images section add 3 images. The first image is used as Base/Small/Thumbnail, and the other two for swatches with these Labels: Blue-swatch, Grey-swatch.
Create 2 Associated Products for each color. In Inventory section you should have Qty >0 and Stock Availability "In Stock".
Now load the Frontend. You should see as options both colors as bellow.
In conclusion, if one option is not available its swatch should be excluded completely from listing in Frontend. Unfortunately Magento treats its image defined with Label format Color-Name-swatch as a product image and this is definitely a bug.
Please note if you set the associated product to Disable its swatch disappears from MORE VIEWS block. See bellow.
The text was updated successfully, but these errors were encountered: