Remove Additional Image Sql Query

hello,

anybody tried to remove additional pictures from db? Which table is holding records?



i need to get rid of additional image 1 for all products.



help needed ;)

unfortunately, you can't do it easily



images information is in “cscart_images” table, but links between images and products are in “cscart_image_links” so it is sufficient to delete records in table with image links



additional images have:

  • type = A;
  • object_type = products;

    difficulty is in understanding which image is first - possibly the one which has minimal value in column “position” so please check

You can also export the images, correct the spreadsheet and import them back using the “Clean up” option (When importing additional images of an updated product, existing images of this product will be deleted before import)

reimporting means i need an additional picture which should replace all aditional images with one. at the end when importing real products which all don't have an additional picture is a problem. …





already tried this solutions. not recommended; )

removing all aditional images would also be helpful

Do you want to remove all addional images from all objects? Or only additional images from products? @wsa has the properties listed you need to address. You woud need to remove the referenced 'path' of the image and the releated image_id key in the images table.

[quote name='tbirnseth' timestamp='1427491532' post='209357']

Do you want to remove all addional images from all objects? Or only additional images from products? @wsa has the properties listed you need to address. You woud need to remove the referenced 'path' of the image and the releated image_id key in the images table.

[/quote]

yes. i wanted to remove all aditiobonal images from products or unlink them. … they can remain on server… Just from the fronend

You should be able to do something similar to this (it's untested because obviously I don't want to perform this action). Suggest you backup your images and image_links tables before running this sql.

```php

delete from cscart_images table first

DELETE FROM cscart_images as i

INNER JOIN cscart_image_links as il

ON (i.image_id=il.detailed_id OR i.image_id=il.image_id)

AND il.object_type='product'

AND il.type='A';

delete from cscart_image_links

DELETE FROM cscart_image_links WHERE object_type='product' AND type='A';

```

Then clear your cache.



This is intended to remove ALL 'alternate images' for ALL 'products' on your system and will leave the actual image in the images directory structure.



And again: Backup the two tables before trying this



Tweak it to your needs.

didn't get this query to work. … I'm just goona clean booth tables and try reupload images