linkin11 Posted January 20, 2023 Share Posted January 20, 2023 Hello I want to make a Query builder that remove all images when stock is 0 and disabled. Can somebody help me with the query how to to this? Or exist a module what do this job? thanks Link to comment Share on other sites More sharing options...
s4lvozesta Posted January 23, 2023 Share Posted January 23, 2023 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 More sharing options...
linkin11 Posted January 23, 2023 Author Share Posted January 23, 2023 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 More sharing options...
s4lvozesta Posted January 24, 2023 Share Posted January 24, 2023 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now