Jump to content
thirty bees forum

Recommended Posts

Posted

hi, in PS I'm using MySql Trigger method (https://mypresta.eu/en/art/tips-and-tricks/how-to-disable-out-of-stock-product.html) to disable out of stock product, but after migrate to 30bz and enable multistore, this method doesn't work anymore. any idea?

Posted

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
FOR EACH ROW
BEGIN
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);
END

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

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...