Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
Created March 25, 2015 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save carlessanagustin/b1dfb03ab8b07f1c15e9 to your computer and use it in GitHub Desktop.
Save carlessanagustin/b1dfb03ab8b07f1c15e9 to your computer and use it in GitHub Desktop.
How to automatically disable out of stock products in PrestaShop
# from http://mypresta.eu/en/art/tips-and-tricks/how-to-disable-out-of-stock-product.html
# trigger name: active2disable_out-of-stock
# table: ps_stock_available
# time: AFTER
# event: UPDATE
# Definition:
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
#Definer: (nothing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment