dosbiner Posted September 5, 2017 Posted September 5, 2017 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?
dynambee Posted September 6, 2017 Posted September 6, 2017 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.
dosbiner Posted September 9, 2017 Author Posted September 9, 2017 Thanks for the tips, I have recheck and found the trouble in my database. dbstock and dbstock_available not sync well.
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