Jump to content


Walter

Member Since 11 May 2017
Offline Last Active Oct 13 2020 07:09 AM
-----

Topics I've Started

Product Inventory Update

26 September 2020 - 09:24 AM

Hey guys,

Who'd be more familiar to how do SQL triggers communicate with an X2CRM, could you comment or share an idea why MySQL trigger below which supposedly should update an inventory level after insert returns a following message: CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'x2_quotes_products.quantity' in 'field list'

 

CREATE TRIGGER `INVENTORY UPDATE`
AFTER INSERT ON `x2_quotes_products`
FOR EACH ROW UPDATE x2_products
SET x2_products.inventory=x2_products.inventory x2_quotes_products.quantity
WHERE x2_quotes_products.quoteId=x2_quotes.id AND x2_quotes_products.productId=x2_products.id
 
Does the app checks x2_fields table? then it would make sense it does not recognize it, but there be a way to avoid checking this table or any other suggestion how would we make this trigger work?
 
Thanks a lot in advance!