Results 1 to 10 of 17

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    32
    Plugin Contributions
    0

    Default Reset store: Delete all orders, customers, etc.

    Hello

    I want to setup a new ZC store by copy-pasting the files and database of my other running ZC store.

    Of course, copy-pasting not only sets up an identical second store but also includes old orders, old customers, ect. of the old store into the new store.

    Does anyone have an idea how I would be able to set my new copied store "to zero", i.e. to delete all old orders, customers, etc. from it?

    I suppose you would be able to do that via deleting tables in the database, but I am not sure this would be a wise thing to do since this may break referencial integrity of the database ...

    And deleting every order etc. by hand is just too exhaustive.

    Any advice would be greatly appreciated!!!
    Thanks!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Reset store: Delete all orders, customers, etc.

    you would be able to do that via deleting tables in the database, but I am not sure this would be a wise thing to do since this may break referencial integrity of the database
    You do not delete them
    You can empty them and this retains the table & structure
    There are many that will require being emptied as orders are indexed to customer, products purchased, etc....
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Mar 2010
    Posts
    32
    Plugin Contributions
    0

    Default Re: Reset store: Delete all orders, customers, etc.

    Quote Originally Posted by kobra View Post
    There are many that will require being emptied as orders are indexed to customer, products purchased, etc....
    Hi Kobra

    In my view, this is exactly the issue. If I delete the content of some tables like orders and customers, I expect that many other tables having references to these emptied tables would need to be adapted/emptied as well. If I don't find all of these references, I would expect that this could damage my database in a pretty unpredictable way.

    And I have actually neither a clue which tables I would have to empty/adapt nor have I found a list of such tables anywhere on the web.

    But on the other hand, I can not believe that there is no elegant solution to this issue (e.g. a cute sql script setting back the database would be nice...).

    Has anyone solved this issue in an elegant manner???

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Reset store: Delete all orders, customers, etc.

    I would expect that this could damage my database in a pretty unpredictable way.
    This is why one should always BACKUP BACKUP BACKUP
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Apr 2008
    Posts
    148
    Plugin Contributions
    0

    Default Re: Reset store: Delete all orders, customers, etc.

    Quote Originally Posted by flix View Post
    But on the other hand, I can not believe that there is no elegant solution to this issue (e.g. a cute sql script setting back the database would be nice...).

    Has anyone solved this issue in an elegant manner???
    Sorry for bumping this old thread but I have the same issue.

    I need to setup a new identical store. I've worked hard installing all modules and modifications and do not wish to start from scratch again :).

    Is my only option here to manually empty the required database fields?

    If so, maybe it's easier to setup a new store from scratch anyways.

    Hmmm...

  6. #6
    Join Date
    Feb 2011
    Posts
    2
    Plugin Contributions
    0

    Default Re: Reset store: Delete all orders, customers, etc.

    Hey, I was looking for some time on how to delete all the orders and customers from my installation of zencart, after no luck in finding it online, I just created an sql script to do this.

    This is pretty much it here, it's helped me. Hopefully it will help you.
    NOTE: this won't touch any of the products or artists, or admin accounts, etc...

    Just the Orders and Customers. And any session entries related to them.

    Use at your own risk, of course:

    Code:
    DELETE FROM zc_address_book;
    DELETE FROM zc_coupon_email_track;
    DELETE FROM zc_coupon_gv_customer;
    DELETE FROM zc_coupon_gv_queue;
    DELETE FROM zc_coupon_redeem_track;
    DELETE FROM zc_customers;
    DELETE FROM zc_customers_basket;
    DELETE FROM zc_customers_basket_attributes;
    DELETE FROM zc_customers_info;
    DELETE FROM zc_customers_wishlist;
    DELETE FROM zc_email_archive;
    DELETE FROM zc_files_uploaded;
    DELETE FROM zc_orders;
    DELETE FROM zc_orders_products;
    DELETE FROM zc_orders_products_attributes;
    DELETE FROM zc_orders_products_download;
    DELETE FROM zc_orders_status_history;
    DELETE FROM zc_orders_total;
    DELETE FROM zc_paypal;
    DELETE FROM zc_paypal_session;
    DELETE FROM zc_paypal_testing;
    DELETE FROM zc_reviews;
    DELETE FROM zc_reviews_description;
    DELETE FROM zc_sessions;
    DELETE FROM zc_whos_online;

  7. #7
    Join Date
    Dec 2010
    Posts
    362
    Plugin Contributions
    0

    Default Re: Reset store: Delete all orders, customers, etc.

    Has anyone else tried this? I'd in the same situation, but I really would hate to cause a massive problem if there's a flaw in this.

    BTW - I'm amazed that someone hasn't come up with a more elegant solution to this problem -- I would think that the ability to clear out customer and order data in an efficient manner would be key to an ecommerce system.

    (I know that sounds snarky, but I don't mean it to -- I'm just surprised that ZC doesn't have this function).

  8. #8
    Join Date
    Aug 2008
    Posts
    63
    Plugin Contributions
    0

    Default Re: Reset store: Delete all orders, customers, etc.

    ok, but what exactly would i need to do with this code?

  9. #9
    Join Date
    Jun 2007
    Location
    Nashville, TN
    Posts
    32
    Plugin Contributions
    1

    Default Re: Reset store: Delete all orders, customers, etc.

    Quote Originally Posted by EastSideAngus View Post
    Hey, I was looking for some time on how to delete all the orders and customers from my installation of zencart, after no luck in finding it online, I just created an sql script to do this.

    This is pretty much it here, it's helped me. Hopefully it will help you.
    NOTE: this won't touch any of the products or artists, or admin accounts, etc...

    Just the Orders and Customers. And any session entries related to them.

    Use at your own risk, of course:

    Code:
    DELETE FROM zc_address_book;
    DELETE FROM zc_coupon_email_track;
    DELETE FROM zc_coupon_gv_customer;
    DELETE FROM zc_coupon_gv_queue;
    DELETE FROM zc_coupon_redeem_track;
    DELETE FROM zc_customers;
    DELETE FROM zc_customers_basket;
    DELETE FROM zc_customers_basket_attributes;
    DELETE FROM zc_customers_info;
    DELETE FROM zc_customers_wishlist;
    DELETE FROM zc_email_archive;
    DELETE FROM zc_files_uploaded;
    DELETE FROM zc_orders;
    DELETE FROM zc_orders_products;
    DELETE FROM zc_orders_products_attributes;
    DELETE FROM zc_orders_products_download;
    DELETE FROM zc_orders_status_history;
    DELETE FROM zc_orders_total;
    DELETE FROM zc_paypal;
    DELETE FROM zc_paypal_session;
    DELETE FROM zc_paypal_testing;
    DELETE FROM zc_reviews;
    DELETE FROM zc_reviews_description;
    DELETE FROM zc_sessions;
    DELETE FROM zc_whos_online;

    Runing v1.5 - Glad I made a backup copy, because after running this script, new orders placed are not showing up in the admin Orders area, and the customer's order history.

    If someone has found a script to safely delete all orders without corrupting the database, then Please Post it here.

    Thank you!


    It's a geek thing. If I had to explain it, you wouldn't understand.

 

 

Similar Threads

  1. v150 Remove ALL customers and ALL orders before a certain date and reset counter history.
    By hawkwynd in forum Managing Customers and Orders
    Replies: 4
    Last Post: 10 Dec 2013, 03:22 AM
  2. 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
  3. How to reset zen cart? ie: delete all customers etc?
    By poosk in forum General Questions
    Replies: 3
    Last Post: 18 Nov 2009, 04:12 PM
  4. All customers fields in ADMIN > CUSTOMERS are empty and I can't delete them!
    By plgaudreau in forum Managing Customers and Orders
    Replies: 1
    Last Post: 26 Feb 2008, 02:08 AM
  5. Delete or reset Pending Orders?
    By atomage in forum General Questions
    Replies: 1
    Last Post: 29 Nov 2006, 02:45 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