Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
FooLab

how to get rid of all the photo except default ones?

Question

I'm in the middle of an import from Virtuemart => external service => TB.

I have all the products with multiple images (double/triple/quadruple) caused from something gone wrong with some syncs in the past.

What can I do to delete from every TB products (database and filesystem) all the images except the default ones?

p.s. AFAIK prestools mass edit can't do that

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

That depends on how the images have been inserted in the database. If each product has one image that is "cover" then it is relatively simple - assuming you are familiar with mysql and PHP. You get then in pseudocode the following: SELECT idimage AS myimage FROM tbimage WHERE cover IS NULL foreach myimage DELETE FROM tbimage WHERE idimage=myimage DELETE FROM tbimagelang WHERE idimage=myimage DELETE FROM tbimageshop WHERE idimage=myimage

That is the database part. But you will also want to delete the images themselves. You can do that with Prestools (it is a paid addon) or you can program it yourself in the loop above.

If there is not a cover for each product (what means that all cover values are NULL) then the loop will become a bit more complicated. So it is important at the start to check that all products have one image where the "cover" field is '1'.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...