berthomas Posted May 20, 2017 Share Posted May 20, 2017 Bonjour, Je suis novice sous prestashop et je souhaite désactiver les produits sans images. Quelqu'un aurait la gentillesse de m'indiquer la requete SQL qui me permettrais de faire ça? Merci d'avance, Bertrand Link to comment Share on other sites More sharing options...
Alexandre Carette Posted May 20, 2017 Share Posted May 20, 2017 Salut, a mon avis il serait plus simple de faire ca avec un export / import csv plutot qu en requete sql cdt Link to comment Share on other sites More sharing options...
berthomas Posted May 20, 2017 Author Share Posted May 20, 2017 (edited) Bonsoir, J'ai tenté avec ces deux requêtes mais çà ne désactive pas les produits en question. UPDATE ps_product SET active = '0' WHERE id_product NOT IN ( SELECT DISTINCT(id_product) FROM ps_image ); UPDATE ps_product_shop SET active = '0' WHERE id_product NOT IN ( SELECT DISTINCT(id_product) FROM ps_image ) Il doit y avoir un autre champs à mettre à jour mais je ne sais pas lequel... Sinon, justement, je trouve ça bien plus simple avec SQL que de passer par un CSV Edited May 20, 2017 by berthomas (see edit history) Link to comment Share on other sites More sharing options...
berthomas Posted May 20, 2017 Author Share Posted May 20, 2017 re, J'ai trouvé la solution. Il faut en plus de faire ce que j'ai fait au dessus, remplir le champs redirect_type de ces deux tables. Voici la requête complète pour ceux que cela peut intéresser : UPDATE ps_product SET active = '0' WHERE id_product NOT IN ( SELECT DISTINCT(id_product) FROM ps_image ); UPDATE ps_product SET redirect_type = '404' WHERE id_product NOT IN ( SELECT DISTINCT(id_product) FROM ps_image ); UPDATE ps_product_shop SET active = '0' WHERE id_product NOT IN ( SELECT DISTINCT(id_product) FROM ps_image ); UPDATE ps_product_shop SET redirect_type = '404' WHERE id_product NOT IN ( SELECT DISTINCT(id_product) FROM ps_image ); 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