Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Location
    Cymru
    Posts
    124
    Plugin Contributions
    0

    Default Delete all orders

    Hi,

    Long story, but I'm splitting my Zen Cart store in two to go on 2 different domains. Some products will stay on the original Store, and others will be on the new store. There is a very good reason for this, but I will not bore you with that!

    Anyway, I have cloned my entire store (files and DB) to the new domain, and I am in the process of deleting the unnecessary products/pages on the new store, and then I will do the same on the old store. There will be no duplication. Can anyone suggest a SQL Patch that will delete ALL orders/order history from my new store? I want to keep the order history on my old domain only, as that is where the order was placed. I have found the following link, and a helpful SQL Patch by DrByte, but this will delete all customer data as well.

    http://www.zen-cart.com/showthread.p...l-my-customers

    I want to allow customers to login at the old & new store, but want to delete the orders they placed only at the new store. I will email all customers who have signed up to the newsletter to let them know that some of the products are now only available on the old store, and others on the new store, and to let them know that they can login to the old or new store using their current login details, but that their order history is only available at the old store.

    Thank you for any help. Here is DrBytes SQL code:

    Code:
    truncate table customers;
    truncate table address_book;
    truncate table customers_info;
    truncate table group_pricing;
    truncate table orders;
    truncate table orders_products;
    truncate table orders_status_history;
    truncate table orders_products_attributes;
    truncate table orders_products_download;
    truncate table orders_total;
    truncate table admin_activity_log;
    truncate table authorizenet;
    truncate table banners_history;
    truncate table counter;
    truncate table counter_history;
    truncate table coupon_email_track;
    truncate table coupon_gv_customer;
    truncate table coupon_gv_queue;
    truncate table coupon_redeem_track;
    truncate table coupon_restrict;
    truncate table customers_basket;
    truncate table customers_basket_attributes;
    truncate table db_cache;
    truncate table email_archive;
    truncate table files_uploaded;
    truncate table paypal;
    truncate table paypal_payment_status_history;
    truncate table paypal_session;
    truncate table sessions;
    truncate table upgrade_exceptions;
    truncate table whos_online;
    PS. Both stores are v1.3.9h. I will update to thew newest version, after doing the work on both stores.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Delete all orders

    Try the following, based solely on your quote above, not on any thorough inspection of the database. I have not tested this. Use at your own risk.
    CAVEAT: USE AT YOUR OWN RISK! MAKE DATABASE BACKUPS BEFORE DOING ANY OF THIS SORT OF THING!
    ONE SHOULD RARELY EVER USE "truncate" STATEMENTS ON THE DATABASE! THIS IS A DESTRUCTIVE ACTION AND WILL RESULT IN LOSS OF DATA!

    Code:
    truncate table orders;
    truncate table orders_products;
    truncate table orders_status_history;
    truncate table orders_products_attributes;
    truncate table orders_products_download;
    truncate table orders_total;
    truncate table admin_activity_log;
    truncate table authorizenet;
    truncate table banners_history;
    truncate table counter;
    truncate table counter_history;
    truncate table coupon_email_track;
    truncate table coupon_gv_customer;
    truncate table coupon_gv_queue;
    truncate table coupon_redeem_track;
    truncate table coupon_restrict;
    truncate table customers_basket;
    truncate table customers_basket_attributes;
    truncate table db_cache;
    truncate table email_archive;
    truncate table files_uploaded;
    truncate table paypal;
    truncate table paypal_payment_status_history;
    truncate table paypal_session;
    truncate table sessions;
    truncate table upgrade_exceptions;
    truncate table whos_online;
    .

    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.

  3. #3
    Join Date
    Jun 2007
    Location
    Cymru
    Posts
    124
    Plugin Contributions
    0

    Default Re: Delete all orders

    Many thanks. :-) Seems to have worked perfectly. All orders deleted, but all customer accounts still there. I will do more tests, and post if there are any issues, incase someone else wants to do something similar. I also have, of course, the full back of the database before running the script.

 

 

Similar Threads

  1. Reset store: Delete all orders, customers, etc.
    By flix in forum Managing Customers and Orders
    Replies: 16
    Last Post: 31 Oct 2012, 08:04 PM
  2. Disable "DELETE" - Make certain admin users not able to delete orders
    By vetpro in forum Managing Customers and Orders
    Replies: 0
    Last Post: 12 Nov 2011, 02:01 PM
  3. Set all Processing orders to Delivered? Or delete all orders?
    By Brian1234 in forum Managing Customers and Orders
    Replies: 11
    Last Post: 29 Jun 2011, 10:04 PM
  4. HELP - Starting today all paypal orders creates 2 orders
    By keylesslocks in forum General Questions
    Replies: 1
    Last Post: 28 Jan 2009, 12:59 AM
  5. One delete button to delete all checked items from cart
    By gsdcypher in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 5 Jul 2007, 04:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR