zoveress Posted September 7, 2010 Share Posted September 7, 2010 Hi, I have built a couple of webshops using prestashop. One of them has a stock feed that changes rapidly I am not very keen on importing and deleting the data manually every time. Is there any php script or command line tool available that creates a product in the database and removes the inactive ones. I did a bit of research in deleting a product from a database and I have a script ready but I am absolutely not sure if I am not messing things up on the db level Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
Nelson Minica Posted September 18, 2011 Share Posted September 18, 2011 Probably too late for you, but for anyone else, based on truncates in AdminImport version 1.4.4.1 here is sql I just used to delete inactive products... as always make a backup, etc... DELETE FROM ps_feature_product WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_product_lang WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_category_product WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_product_tag WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_image_lang WHERE id_image IN (SELECT id_image from ps_image i LEFT JOIN ps_product p ON i.id_product=p.id_product WHERE p.active=0); DELETE FROM ps_image WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_specific_price WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_specific_price_priority WHERE id_product IN (SELECT id_product from ps_product WHERE active=0); DELETE FROM ps_product WHERE active=0; Link to comment Share on other sites More sharing options...
a-d-g Posted December 11, 2011 Share Posted December 11, 2011 with that querys you can delete products, but you need to delete pictures from server to complete it. 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