magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Incorrect small image url returned from product helper

Open AirmanAJK opened this issue 10 years ago • 2 comments

I have installed a search autocomplete extension. I noticed that when products do not have an image associated, rather than showing the "No Image" result, it showed the broken link image square. I tracked the problem to the class "\vendor\magento\module-catalog\Helper\Product.php" in the function getSmallImageUrl().

If an image is added and then removed in Magento, the database value for the image attributes will be "no_selection". The getSmallImageUrl() function only checks !$product->getSmallImage(). I believe it should be changed to the following:

$smallImage = $product->getSmallImage();
if (!$smallImage || $smallImage == "no_selection") {

Reproducing this isn't straightforward without the third part extensions. But if you add a product image, then remove it. Execute the function getSmallImageUrl(). You will get "no_selection" returned instead of the proper image retrieved by the _assetRepo object.

AirmanAJK avatar Sep 22 '16 13:09 AirmanAJK

@AirmanAJK thank you for your feedback. Please, format this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result. Please, also identify which version of Magento you are running.

veloraven avatar Sep 26 '16 13:09 veloraven

According to contributor guide, tickets without response for two weeks should be closed. If this issue still reproducible please feel free to create the new one: format new issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result and specify Magento version.

veloraven avatar Oct 11 '16 16:10 veloraven