Post by IT-Me-Up.co.uk » Fri Jan 11, 2019 5:57 pm

Hi there,

I have imported some products with some incorrect stock status, would this SQL work?

UPDATE `itmeup_product`
SET stock_status_id = CASE
WHEN quantity=0 THEN 5*stock_status_id
ELSE stock_status_if
END

If Quantity is = then set Stock Status 5 = (Out of Stock)
Currently its is showing as 6 (2-3 Days)

Please Check Out My Site:
https://www.IT-Me-Up.co.uk/



Posts

Joined
Thu Sep 21, 2017 4:27 pm

Post by xxvirusxx » Fri Jan 11, 2019 7:06 pm

Why dont' use something like this?

Code: Select all

UPDATE `itmeup_product` SET stock_status_id = X  WHERE quantity = 0;
or

Code: Select all

UPDATE `itmeup_product` SET stock_status_id = X  WHERE quantity = 0 AND something_else = Y;
etc...

Is weird to ask for 20 years experience in IT :)

Opencart 3.0.2.0 with bugs fixed | Free extensions


Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Who is online

Users browsing this forum: No registered users and 35 guests