cancel
Showing results for 
Search instead for 
Did you mean: 

Delete gallery image diesnt check if images are used in other products

0 Kudos

Delete gallery image diesnt check if images are used in other products

Feature request from schnappenberger, posted on GitHub Nov 09, 2016

if you delete an image a.jpg from a product A gallery and have another product B which uses a.jpg, then a.jpg will be deleted in file system and product B looses this image also.

Preconditions

  1. Magento 2.1.2
  2. PHP7
  3. Apache 2
  4. Mysql 5

Steps to reproduce

  1. Import some Products with the same image gallery
  2. Open a product in admin and delete an image, which is used in other products
  3. Have a look on the gallery of the other products

Expected result

  1. Image relation is deleted from database, the image in filesystems stays if there are relations from other products
  2. Image in filesystem is only deleted if there are no other relations

Actual result

  1. Image relation in database and in filesystem is deleted
  2. Other products which uses this image have now a relation to a non existing image file
4 Comments
apiuser
New Member

Comment from palamar, posted on GitHub Nov 11, 2016

Hello

This is not a bug but expected behavior for such case. A bug report converted to improvement.

apiuser
New Member

Comment from schnappenberger, posted on GitHub Nov 11, 2016

Placeholder images in product listings and detail views are expected behaviour? How can i replace such an image without loosing images in other places?

apiuser
New Member

Comment from palamar, posted on GitHub Nov 11, 2016

If you want replace default placeholder image, you can do this in (admin area) -> Stores -> Configuration -> Catalog -> Catalog -> Product Image Placeholders globally for all websites or for each website or store view separately.

apiuser
New Member

Comment from schnappenberger, posted on GitHub Nov 11, 2016

Sorry, that was missleading. I meant if you delete an image which is used in other products you will see an placeholder image on these products because the source file doesn’t exists anymore. I don’t have the possibility to delete only the relation and keep the source file.

In a huge catalog with a grown structure of images and products it’s nearly unpossible to say where those duplicated images were used.