Zen Cart Logo
Forums / Managing Customers and Orders / Delet old orders

Delet old orders

Locked

Views: 1,444

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
4 Apr 2008, 12:41 PM
#1
cedomir avatar

cedomir

New Zenner

Join Date:
Nov 2006
Posts:
10
Plugin Contributions:
0

Delet old orders

Hi everyone
I'm running an old store and have an abundance of old orders that would best be deleted, and deleting them one by one is rather tedious.

Is there an easy way to delete all orders older than X with all entries in the orders_status/products/attributes/etc table or should I just go through phpmyadmin?

or is this something yet to be done?

Cheers

6 Apr 2008, 10:30 PM
#2
wolfsz avatar

wolfsz

Zen Follower

Join Date:
Mar 2006
Location:
Australia
Posts:
286
Plugin Contributions:
3

Re: Delet old orders

Hi there
As far as I know you would need to use phpmyadmin.
Howevere be aware that you would need to find each order in orders where purchase_date < xxxx-xx-xx, remember the orders_id and then delete all records with that orders_id from orders_products, orders_products_attributes, orders_status_history and orders_total. Do not touch orders_statues since this is the list of your order stratues.

9 Apr 2008, 7:14 PM
#3
cedomir avatar

cedomir

New Zenner

Join Date:
Nov 2006
Posts:
10
Plugin Contributions:
0

Re: Delet old orders

since order Id's are in time order as well i simply used this (just not sure if I missed any relevant tabletable):

DELETE FROM _orders WHERE orders_id<X0000000;
DELETE FROM _orders_products WHERE orders_id<X0000000;
DELETE FROM _orders_products_attributes WHERE orders_id<X0000000;
DELETE FROM _orders_products_download WHERE orders_id<X0000000;
DELETE FROM _orders_status_history WHERE orders_id<X0000000;
DELETE FROM _orders_total WHERE orders_id<X0000000;

9 Apr 2008, 10:17 PM
#4
wolfsz avatar

wolfsz

Zen Follower

Join Date:
Mar 2006
Location:
Australia
Posts:
286
Plugin Contributions:
3

Re: Delet old orders

Looks good to me.

10 Apr 2008, 1:48 AM
#5
kim avatar

kim

Obaa-san

Join Date:
Jun 2003
Posts:
26,601
Plugin Contributions:
0

Re: Delet old orders

Before deleting any orders - you may want to check with your accountant about how long you should hang onto your records.

10 Apr 2008, 3:42 PM
#6
cedomir avatar

cedomir

New Zenner

Join Date:
Nov 2006
Posts:
10
Plugin Contributions:
0

Re: Delet old orders

I export all orders anyways and there's always a DB backup that I can run on localhost so I don't see a problem there

thanks for help