Zen Cart Logo
Forums / Managing Customers and Orders / Bulk change to order status using SQL query for certain products?

Bulk change to order status using SQL query for certain products?

Views: 2,252

Results 1 to 4 of 4
26 Aug 2011, 1:31 PM
#1
neo2810 avatar

neo2810

New Zenner

Join Date:
Mar 2011
Posts:
9
Plugin Contributions:
0

Bulk change to order status using SQL query for certain products?

I have a site with only 5 products (they will change regularly but the product ID will remain the same as I'll just be changing the detail). I want to be able to change, in bulk, the status for each product from
"pending" to "processed".

I've seen the SQL query to change ALL pending products to processed so can someone tell me what string I need to add to apply to specific product ID?

This is what I think will do it for all products:

UPDATE orders SET orders_status=2 WHERE orders_status=1
INSERT INTO orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments)
VALUES ($id, 2, '2010-03-03 23:00:00', 0, 'order status was changed to History by Admin')

So do I need something like
(excuse my lack of SQL knowledge):

UPDATE orders SET orders_status=2 FOR products_id=6 WHERE orders_status=1
INSERT INTO orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments)
VALUES ($id, 2, '2010-03-03 23:00:00', 0, 'order status was changed to History by Admin')

And one more thing. Instead of the hardcoded date, what string variable can I insert to use that day's date instead: "'DATETIME: Auto NOW()', NOW()"?

13 Sep 2011, 1:17 PM
#2
zskiman avatar

zskiman

New Zenner

Join Date:
Mar 2005
Posts:
69
Plugin Contributions:
0

Re: Bulk change to order status using SQL query for certain products?

you could try this , no promises though

UPDATE orders SET orders_status=2 WHERE products_id=6 && orders_status=1
INSERT INTO orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments)
VALUES ($id, 2, '2010-03-03 23:00:00', 0, 'order status was changed to History by Admin')

13 Sep 2011, 7:36 PM
#3
neo2810 avatar

neo2810

New Zenner

Join Date:
Mar 2011
Posts:
9
Plugin Contributions:
0

Re: Bulk change to order status using SQL query for certain products?

Thanks for trying bud, but that failed...

24 Feb 2012, 7:34 PM
#4
maryneilsen avatar

maryneilsen

New Zenner

Join Date:
Feb 2012
Location:
connecticut
Posts:
3
Plugin Contributions:
0

Re: Bulk change to order status using SQL query for certain products?

Any update on this? Can't find any help. Thanks!