pixAN Posted April 29, 2018 Share Posted April 29, 2018 Bonjour, Je souhaite ne pas afficher les produits hors stock sur mon site (prestashop 1.6) , je souhaite utiliser un trigger sql comme celui-ci : CREATE TRIGGER change_active_after_update AFTER UPDATE ON ps_stock_available FOR EACH ROW BEGIN UPDATE ps_product_shop SET active=0 WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity=0); UPDATE ps_product_shop SET active=1 WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity>0); END Cependant cela ne fonctionne pas Par contre si je passe par une tache cron (en appelant un fichier php) cela fonctionne ... Quelqu'un a t-il eu le même problème? merci Link to comment Share on other sites More sharing options...
doekia Posted April 29, 2018 Share Posted April 29, 2018 for each row mais tu ne filtres pas sur l'id_produit concerné ?? !! ?? d'autant que je ne vois rien qui empêche le trigger de se lancer lorsque tu updates dans le trigger. tu n'as pas peur des dead locks et des problèmes de performances à priori, heureusement que ton moteur SQL refuse d'exécuter ton code Il y a un module qui fait ce que tu veux sans utiliser de trigger et qui fonctionne: https://eoliashop.com/updateelements Link to comment Share on other sites More sharing options...
pixAN Posted April 29, 2018 Author Share Posted April 29, 2018 merci, c'est exactement ce que je recherche . 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