Jump to content
thirty bees forum

Disable out of stock product


Recommended Posts

I suspect this is a table name issue. The sample code uses the default PS table names which start with ps_ while 30bz default table names begin with tb_. If you modify the code to match your table names it should still work:

CREATE TRIGGER change_active_after_update AFTER UPDATE ON tb_stock_available
UPDATE tb_product_shop SET active=0 WHERE id_product IN (SELECT id_product FROM tb_stock_available WHERE quantity=0);
UPDATE tb_product_shop SET active=1 WHERE id_product IN (SELECT id_product FROM tb_stock_available WHERE quantity>0);

Of course if you are using non-standard table names then you will need to modify the code above to match your tables.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...