Jump to content

[solved] SQL query for update stock


Recommended Posts

Hi

 

I am trying to update the stock on my website with SQL query but it is not working.

 

This is what I have:

 

 

UPDATE ps_product

SET

quantity = [{NewQuantity}],

date_upd = '[{dProcessedOn}]'

WHERE reference = '[{ChannelSKU}]';

--GO;--

UPDATE ps_product_attribute

SET

quantity = '[{NewQuantity}]'

WHERE reference = '[{ChannelSKU}]';

 

Can someone tell me what I am doing wrong.

 

Thanks in advance.

Link to comment
Share on other sites

Hi

 

I am using the newest version and have solved the issue.

 

 

UPDATE

`ps_stock_available` AS sa

INNER JOIN `ps_product` AS p on p.id_product = sa.id_product

SET

sa.quantity = CONVERT('[{NewQuantity}]', signed integer),

p.quantity = CONVERT('[{NewQuantity}]', signed integer)

WHERE p.reference = '[{ChannelSKU}]'

--GO;--

UPDATE ps_product_attribute

SET

quantity = CONVERT('[{NewQuantity}]', signed integer)

WHERE reference = '[{ChannelSKU}]';

 

This seems to be working thanks.

Link to comment
Share on other sites

×
×
  • Create New...