Forums / Managing Customers and Orders / How to delete old orders from order history?

How to delete old orders from order history?

Locked

Views: 11,498

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
16 Jan 2008, 9:05 PM
#1
david_bo avatar

david_bo

New Zenner

Join Date:
Oct 2006
Posts:
23
Plugin Contributions:
0

How to delete old orders from order history?

  1. I would like to remove all orders older than 3 years from the order history. How do I do that?

  2. How can I calculate the present price of a purchased product in some old order with the same attributes settings as it had when the order was purchased?

  3. Is it possible to delete a product after it has been bought? If possible doesn't it make the products_id reference in table orders_products obsolete?

16 Jan 2008, 10:22 PM
#2
nomadrw avatar

nomadrw

Zen Follower

Join Date:
Sep 2007
Location:
Somewhere in Southern Cal
Posts:
331
Plugin Contributions:
0

Re: How to delete old orders from order history?

The first two you can do with a SQL program.

nomad

17 Jan 2008, 5:06 AM
#3
wolfsz avatar

wolfsz

Zen Follower

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

Re: How to delete old orders from order history?

to anser 3.
every time you delete a row from a database that id is no longer in use since MySQL will always add to the last ID.

Wolf Skafte-Zauss
http://e-commerce-pros.com
Tools for E-commerce Professionals

17 Jan 2008, 5:31 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: How to delete old orders from order history?

I'm not sure the posts above are actually answering your questions.

David Bo:

  1. I would like to remove all orders older than 3 years from the order history. How do I do that?

  2. How can I calculate the present price of a purchased product in some old order with the same attributes settings as it had when the order was purchased?

  3. Is it possible to delete a product after it has been bought? If possible doesn't it make the products_id reference in table orders_products obsolete?

  1. There is no built-in purge facility in Zen Cart at the present time. If you want to remove old records in large quantities, you'll need to do it manually by direct database access.
    The tables related to order history are listed here:
    http://www.zen-cart.com/wiki/index.php/Developers_-_Database_Schema#Order_History

  2. This is not an easy task, and may actually not be possible after-the-fact, given the current database structure. Your best option for this would be to recreate the order afresh, selecting the specified attributes detailed in the old order's line-item information.

  3. Sure, deleting a product from the database can be done quite easily. Granted, as you mentioned, you will be orphaning it from orders, meaning that existing orders won't be able to allow any lookups on the details of the original product.

There are caveats to removing any data from a relational database. Do so at your own risk.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.