Zen Cart Logo
Forums / General Questions / Remove Orders & Customer Info from DB

Remove Orders & Customer Info from DB

Locked

Views: 982

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
21 Jul 2010, 1:05 AM
#1
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Remove Orders & Customer Info from DB

Hi, just wondering if it's possible to run a script on the DB to remove customer info and order history info and anything else that's related? Basically I want to keep all products and configuration info there, but act as if the store is starting from Order #1 all over again.

Cheers

21 Jul 2010, 1:14 AM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,771
Plugin Contributions:
9

Re: Remove Orders & Customer Info from DB

Anythings possible but quite a few are never tried because it's easier to do it a different way. Necessity was NOT the mother of invention --- It was laziness!:yes:

Unless you just have to divorce yourself from former customers, why bother? No one has to know but you.:unsure:

21 Jul 2010, 1:30 AM
#3
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Reason being I need to setup a clone site for the same customer where a majority of the products will be the same, but obviously purchase/customer history will need to be emptied.

21 Jul 2010, 1:47 AM
#4
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,771
Plugin Contributions:
9

Re: Remove Orders & Customer Info from DB

Then you might want to set the new site up bare (in Texas we say nekkid) and use easy populate to take the products off the old and add them to the new.

21 Jul 2010, 2:41 AM
#5
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Thanks for the tip, though I also want to move any configuration information across to the new site so initially seems easier to just remove the customer/purchase data, I just need to make sure that any other related data is also removed so as to not cause any breakages in data relationship. I haven't used the ZC DB that much so was hoping someone could easily tell me which tables I need to concentrate on, otherwise I'll have to go study it all for a while

cheers

21 Jul 2010, 2:41 AM
#6
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

I would have to agree with dbltoe. I see this question a lot of here, I just don't understand why people don't like to start fresh. Or just Copy the site over and don't worry about customers info. What are the odds that same email would be used again on the new site. But again it happens to me a lot on my smaller sites.

I have a lot of small niche sites that have the same products as the main site. Thank GOD to EP. it's a matter of export and edit then import into the new site. Don't have to worry about customer information or anything else.

You can edit the customer related information easily in myphpadmin but again if you knew how to do it you wouldn't ask in here, which leads me to say, don't attempt to do it in phpamdin.

21 Jul 2010, 2:47 AM
#7
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Copying over the site is no problem, but having old info interferes with stats etc of total sales, # of customers, newsletter mailouts and what not.

Im comfortable with t-sql so don't have an issue clearing info out, I just don't have a huge amount of experience with this database so don't know off the top of my head what's related.

21 Jul 2010, 2:52 AM
#8
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Then Easy Populate is the best solution.
Why would you want to have a duplicate site anyway. That will hurt SER and SEO. I only do it to create niche sites and test different ideas before implementing them into the large site.

21 Jul 2010, 3:05 AM
#9
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

But from what it seems, EP will only do the products, whereas I want all configuration info stored in the DB also moved across.

The customer wants a duplicate of the site with a different skin and no customer/purchase history. 90% of the products will remain the same. It's a bit more of a site targeted towards a niche market.

So if EP is the best method I guess my process will be something like:

  • Setup new site
  • Copy across theme (to be re-skinned)
  • Duplicate all admin settings manually
  • Use EP to move across product data
21 Jul 2010, 3:35 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Orders & Customer Info from DB

If ALL you want to remove is customers and orders, then you'll need to TRUNCATE the tables related to Customer Information and Order History:
http://www.zen-cart.com/wiki/index.php/Developers_-_Database_Schema#Customer_Information
http://www.zen-cart.com/wiki/index.php/Developers_-_Database_Schema#Order_History

If you've been receiving payments via PayPal, then I recommend also truncating the "paypal" and "paypal_payment_status_history" and "paypal_session" tables.

21 Jul 2010, 4:00 AM
#11
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Thanks DrByte I'll proceed on that advice :)

21 Jul 2010, 6:27 AM
#12
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

I've truncated those tables as well as counter and counter history. It's all looking good so far, however I can't see where the values are stored when going into Admin under Reports > Products Viewed. These values are still there from the other site. I've been looking through tables trying to find them but haven't come across them yet. Can't see anything on the wiki about this either.

I'll keep hunting but figured I'd post for future reference in case anyone is doing something similar to this.

21 Jul 2010, 6:32 AM
#13
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Found what I was looking for:

products_description
cleared out products_viewed column

products
cleared out products_ordered column

Will post any more info if I find unwanted history.

21 Jul 2010, 7:41 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Orders & Customer Info from DB

uneek:

I've truncated those tables as well as counter and counter history. It's all looking good so far, however I can't see where the values are stored when going into Admin under Reports > Products Viewed. These values are still there from the other site. I've been looking through tables trying to find them but haven't come across them yet. Can't see anything on the wiki about this either.

I'll keep hunting but figured I'd post for future reference in case anyone is doing something similar to this.
Those can be reset in Admin->Tools->Store Manager

21 Jul 2010, 7:46 AM
#15
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Re: Remove Orders & Customer Info from DB

Yeah I noticed that once I went through all of the Admin pages making changes to the domain name. Spewing I didn't know beforehand, not that it takes much to do it through the back-end but much easier to just hit a Reset button!

21 Jul 2010, 7:47 AM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Orders & Customer Info from DB

uneek:

...but much easier to just hit a Reset button!
And MUCH safer too.