Magento2: Products showing old images - Magento 2.2.4

Created on 27 Jun 2018  路  10Comments  路  Source: magento/magento2

Preconditions

  1. Php 7
  2. Magento 2.2.4

Steps to reproduce

  1. Create a simple product with image
  2. Dublicate this product a couple of times
  3. Go the new duplicated products, edit them and delete the images
  4. Reindex and clear cache
  5. Go to front end to check the products

Expected result

  1. The new products should not show images that have been already deleted.

Actual result

  1. The images have been deleted but they're still showing in front end.
  2. The products' thumbnails has the image that has been deleted (it's link: >"https://boutique.estampesray.com/pub/media/catalog/product/cache/f073062f50e48eb0f0998593e568d857/c/o/colop-printer-54_1.,jpg")
  1. System.log shows these errors everytime I open a product that has this issue:
    capture
    Copied:

[2018-06-27 19:12:48] main.INFO: Broken reference: the 'catalog.compare.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] [] [2018-06-27 19:12:48] main.INFO: Broken reference: the 'sale.reorder.sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] [] [2018-06-27 19:12:48] main.INFO: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] [] [2018-06-27 19:12:48] main.INFO: Broken reference: the 'skip_gallery_before' tries to reorder itself towards 'product.info.media.image', but their parents are different: 'skip_gallery_before.wrapper' and 'product.info.media' respectively. [] [] [2018-06-27 19:12:48] main.INFO: Broken reference: the 'skip_gallery_after' tries to reorder itself towards 'product.info.media.image', but their parents are different: 'skip_gallery_after.wrapper' and 'product.info.media' respectively. [] []

  1. Here's an example:
    https://boutique.estampesray.com/fr-ca/catalogsearch/result/?q=+RS-SR-P54-1
    The thumbnail of "Caoutchouc pour Printer 54" is showing an image that has been deleted,
    https://boutique.estampesray.com/fr-ca/colop-printer-q-59
Catalog Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x

Most helpful comment

Hi, I'm facing the same problem, and I'm really frustaded as well.

The reason why this happens is because Magento copies the default values into every single storeview. So if you have the images set in global scope and duplicate the product the image gets set in default and every single storeview.

Once you delete the image in default set only the images get's removed and the reference in deleted.
All other stores are still referencing the deleted image and since the image is not available in the media gallery you are not able to delete it from admin backend. uhh

Your only fix for now is to go to your database and remove every entry that is not set in the default storeview.

DELETE FROM catalog_product_entity_varchar where attribute_id in (85,86,87) and store_id >0

But be careful and check twice what you are doing before executing the statement.

After that you need to reindex and clear the cache.

All 10 comments

Hi @mariamghalleb. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

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.

@mariamghalleb do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi, I'm facing the same problem, and I'm really frustaded as well.

The reason why this happens is because Magento copies the default values into every single storeview. So if you have the images set in global scope and duplicate the product the image gets set in default and every single storeview.

Once you delete the image in default set only the images get's removed and the reference in deleted.
All other stores are still referencing the deleted image and since the image is not available in the media gallery you are not able to delete it from admin backend. uhh

Your only fix for now is to go to your database and remove every entry that is not set in the default storeview.

DELETE FROM catalog_product_entity_varchar where attribute_id in (85,86,87) and store_id >0

But be careful and check twice what you are doing before executing the statement.

After that you need to reindex and clear the cache.

Hi, this issue has been fixed in 2.3.x version
thank you for your report.
We've acknowledged the issue and added to our backlog.

This scenario is most likely covered by https://github.com/magento/community-features/issues/23.

@pointia Assuming that you are clearing the image, small_image and thumbnail attributes, you may need to change the attribute IDs to match them in your installation, as mine existed at 87,88 and 89 respectively.

@ryanpalmerweb that's true. That's the reason why I wrote a decent explanation and the following sentence.

But be careful and check twice what you are doing before executing the statement.

But you are right I should have mentioned that 85,86,87 are the attribute_ids of the image, small_image and thumbnail attributes.

Hi @engcom-backlog-nazar. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Hi @mariamghalleb The issue was re-tested and we can confirm that it was fixed on the 2.3 release branch. We closing this issue as fixed due to upcoming 2.3 release that will be available soon.

@engcom-backlog-nazar can you please tell the fix or patch ? because my client doesn't want to upgrade to 2.3 but I have to fix this issue

I am using 2.3.0 and have the same problems.
Magento is pushing everyone to upgrade and we still have these bugs.

Was this page helpful?
0 / 5 - 0 ratings