Jump to content

Query builder remove images when stock is 0 and disabled.


linkin11

Recommended Posts

Images are stored as physical jpg files. I should not think query (SQL) would be able to remove physical image files.

However, with adv stock off, products having 0 quantity and disabled can be (obviously) retrieved by

SELECT * FROM ps_product WHERE quantity = 0 AND active = 0

 

Its result would be used further to find the physical image file. For that, maybe this thread could help

https://www.prestashop.com/forums/topic/926323-retrieve-products-picture-url/

 

Cheers!

Link to comment
Share on other sites

26 minutes ago, s4lvozesta said:

Images are stored as physical jpg files. I should not think query (SQL) would be able to remove physical image files.

However, with adv stock off, products having 0 quantity and disabled can be (obviously) retrieved by

SELECT * FROM ps_product WHERE quantity = 0 AND active = 0

 

Its result would be used further to find the physical image file. For that, maybe this thread could help

https://www.prestashop.com/forums/topic/926323-retrieve-products-picture-url/

 

Cheers!

After this all image columns must be flushed, and after that i can use a image cleaner that remove images who don't have a link.

Is this the solution?

What query must be next to flush the image link columns tables?

thanks allot

Link to comment
Share on other sites

I do not think there is 'image columns' from the query above (or maybe there is in some version of prestashop? not sure). 

The table `ps_image` might be of your interest too.

On the above link, there are sample codes to follow. This function might be useful for you 
 

print $link->getImageLink

 

Lastly, write PHP code to remove respected file images 

Link to comment
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...