Hello,
I have added trigger for my database with this options:
and here is trigger:
QuoteBEGIN
UPDATE ps_product SET visibility = 'search' WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity = 0 AND id_product_attribute = 0);
UPDATE ps_product SET visibility = 'both' WHERE id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity > 0 AND id_product_attribute = 0);
END
I have product ID 20 with visibility "both". Then I change his quantity to 0 via backoffice.
After this in database at table ps_stock_available ps_product_shop I can see that visiblity for this product had changed (trigger theoretically worked):
But at backoffice and frontoffice it is not working correctly:
- BO: edit product -> options -> visibility is still "both",
- FO: product is visible both at category page and search results.
What could be wrong in this code?
When for test I changed trigger for example like:
UPDATE ps_product SET visibility = 'search12345678'
trigger is not working at all.
PS 1.7.5
.png.022b5452a8f28f552bc9430097a16da2.png)