If this is your first visit, check our documentation. To post, register or login.

deleting all data

Locked

Started by limelites on 23 Apr 2010, 4:31 PM · Views: 969

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
23 Apr 2010, 4:31 PM
#1
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

deleting all data

I don't suppose anyone has a batch file that deletes all customers, customer orders and products from a zen cart install?

I've used another site as a template, which is good, but all the customers and products need to go and I don't want to leave fragments behind in related tables.

Anyone?

23 Apr 2010, 5:33 PM
#2
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: deleting all data

OK, finally figured this out, been at it all day!

These are the tables to delete when you copy an existing site to a new server as a template. to get rid of the existing customers, existing orders and existing products (and all the loose ends that are associated with them) just run this querry from PHPmyADMIN:

DELETE FROM customers;
DELETE FROM customers_admin_notes;
DELETE FROM customers_basket;
DELETE FROM customers_basket_attributes;
DELETE FROM customers_info;
DELETE FROM customers_wishlist;
DELETE FROM products;
DELETE FROM manufacturers;
DELETE FROM manufacturers_info;
DELETE FROM paypal;
DELETE FROM paypal_payment_status;
DELETE FROM paypal_payment_status_history;
DELETE FROM paypal_session;
DELETE FROM paypal_testing;
DELETE FROM nochex_apc_transactions;
DELETE FROM nochex_sessions;
DELETE FROM orders;
DELETE FROM orders_status_history;
DELETE FROM orders_products_download;
DELETE FROM orders_total;
DELETE FROM orders_products;
DELETE FROM orders_products_attributes;
23 Apr 2010, 5:39 PM
#3
drbyte avatar

drbyte

Sensei

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

Re: deleting all data

limelites,
That list will DEFINITELY cause you problems.

You've forgotten the address-book, all the product-related tables, all the attribute-related tables, and you've listed several tables that don't exist in a clean ZC install.

Also, TRUNCATE TABLE is better than DELETE FROM

http://www.zen-cart.com/wiki/index.php/Developers_-_Database_Schema

.
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.

23 Apr 2010, 6:24 PM
#4
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: deleting all data

Thanks Dr. Byte, I'll take a look at those now...

12 May 2010, 1:29 PM
#5
crafterscafe avatar

crafterscafe

New Zenner

Join Date:
May 2009
Posts:
38
Plugin Contributions:
0

Re: deleting all data

I am looking at selling shop and do not want to transfer over old order data - however want to transfer all products & customers. any way to do this?

I have lots of orders so going through and using the "delete" order would be crazy. so i was trying to figure out just what happens when you click that "delete" button. Then rather then makiing it for just that order I could use * in the sql command.

Help please.