Magento 2.2.5 Community
PHP 7.1
Server Apache
Product images displaying is inconsistent on Mini-Cart, Shopping Cart and Checkout.
Hi @willwright111. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me {$VERSION} instance
where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.
@willwright111 do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@willwright111, thank you for your report.
We've acknowledged the issue and added to our backlog.
It seems that fix https://github.com/magento/magento2/issues/8168 added in Magento 2.2.5 introduced this issue.
My proposed solution is to change lines 125-130 of vendor/magento/module-catalog/Block/Product/ImageBuilder.php to the following:
$simpleOption = $this->product->getCustomOption('simple_product');
if ($simpleOption !== null) {
$optionProduct = $simpleOption->getProduct();
if ($optionProduct->getThumbnail() !== null) {
$this->setProduct($optionProduct);
}
}
`
Not sure if this is the best approach, but it's working for now.
@willwright111
The issue has been fixed.
Related commit(s):
@ronak2ram Thanks for the reply.
I thought lines 125-130 of ImageBuilder.php are supposed to fix https://github.com/magento/magento2/issues/8168.
It appears that the commit you referenced (https://github.com/magento/magento2/commit/108c2c5f6353bf977508baa20cef200521eb247d) breaks support for this. I believe that it is still supposed to be getCustomOption instead of getOptionById to be able to display the variation's image (if present). I think getOptionById() is a method for products with custom options setup, not configurable products.
However, there still needs to be a check if the variation even has a product image prior to using it as the CartWishlist's image.
@numan201 You right,
My solution is not working for a wishlist image.
We have to find some better solution for it.
@ronak2ram, what're your thoughts on the potential solution I posted earlier?
@numan201
Your solution does not work on cart page.
Please test this(#16843 ) issue with your solution.
@ronak2ram My solution seems to be working fine on the cart page for me.
You checked with both option ?
Configuration > Sales > Checkout > Configurable Product Image
Check pages Cart page, Mini cart, Wishlist with both option.
If you solution work than you can create pull request for magento developer and developer will be test your code.
Would it be a good solution to check first checkout/cart/configurable_product_image configuration before retrieving the needed image? Please have a look at the proposed solution https://github.com/apedicdev/magento2/commit/55a252d6a71e989907e1f4af7fa1f3023b6e7e1b
Noticing the same problem -- same preconditions and actual results: Parent image visible in minicart and checkout, but child image displaying on cart page, despite Configuration settings as "Configurable Product Image" 1. Parent Product Thumbnail
Reproduced on 2.2.5
Appears to be resolved in 2.2.6 with pull request https://github.com/magento/magento2/pull/16863
Hello @willwright111 @kevinvarley @BubblegumAnarchy
As we can see from the comment above https://github.com/magento/magento2/issues/17174#issuecomment-427104391 this issue is fixed in https://github.com/magento/magento2/pull/16863
It is available in 2.2-develop now and should be availabe in 2.2.6
This ticket can be closed.
Please, feel free to reopen or create a new one if issue still exists or was not fully fixed
Thank you for feedback and collaboration
Most helpful comment
Appears to be resolved in 2.2.6 with pull request https://github.com/magento/magento2/pull/16863