Jump to content
  • 0
mcfreedom

[Solved] How to reset or delete all orders and customers?

Question

45 answers to this question

Recommended Posts

  • 0
Hi,

You can delete customers via your admin panel, you can also truncate MySQL tables:

[code]
TRUNCATE TABLE `ps_customer`;
TRUNCATE TABLE `ps_address`;
TRUNCATE TABLE `ps_orders`;
TRUNCATE TABLE `ps_order_detail`;
TRUNCATE TABLE `ps_order_discount`;
TRUNCATE TABLE `ps_order_history`;
TRUNCATE TABLE `ps_message`;
TRUNCATE TABLE `ps_cart`;
TRUNCATE TABLE `ps_cart_product`;
TRUNCATE TABLE `ps_cart_discount`;
[/code]

Share this post


Link to post
Share on other sites
  • 0
[quote author="Bruno Lévêque" date="1229420778"]Hi,

You can delete customers via your admin panel, you can also truncate MySQL tables:

[code]
TRUNCATE TABLE `ps_customer`;
TRUNCATE TABLE `ps_address`;
TRUNCATE TABLE `ps_orders`;
TRUNCATE TABLE `ps_order_detail`;
TRUNCATE TABLE `ps_order_discount`;
TRUNCATE TABLE `ps_order_history`;
TRUNCATE TABLE `ps_message`;
TRUNCATE TABLE `ps_cart`;
TRUNCATE TABLE `ps_cart_product`;
TRUNCATE TABLE `ps_cart_discount`;
[/code][/quote]

Will the ordernumber ect. start with 000001 again because I think this is what most of us want after testing ;-)

Share this post


Link to post
Share on other sites
  • 0
@TRUTHSEEKER

When your in phpMyAdmin, on the left side choose the database you want to truncate. Now you get a diferent window an you have tabs on the top of the page... Click on the SQL tab (second from the left?) and paste the code there and click run or execute (bottom right corner).

Hope this helps.

Share this post


Link to post
Share on other sites
  • 0
Is it possible to just delete the sample order? I already have about 10 orders, and don't want to reset as I will loose this information. I need to just remove the sample order so that the stats in my store gives the correct information. Please help! Thank you!

Share this post


Link to post
Share on other sites
  • 0
[quote author="Rory" date="1236616966"]Is it possible to just delete the sample order? I already have about 10 orders, and don't want to reset as I will loose this information. I need to just remove the sample order so that the stats in my store gives the correct information. Please help! Thank you![/quote]

If you would have used the search you would have know you need to do that directly in your database via phpMyAdmin.

Share this post


Link to post
Share on other sites
  • 0
Thanks for your help, don't know what I would have done without it!

[quote author="TropischBruin" date="1236618995"][quote author="Rory" date="1236616966"]Is it possible to just delete the sample order? I already have about 10 orders, and don't want to reset as I will loose this information. I need to just remove the sample order so that the stats in my store gives the correct information. Please help! Thank you![/quote]

If you would have used the search you would have know you need to do that directly in your database via phpMyAdmin.[/quote]

Share this post


Link to post
Share on other sites
  • 0
Got it, here's how you do it, you need this code... ...you need to be logged in too.

yourshop.fr/your-admin-folder/index.php?tab=AdminOrders&id_order=1&deleteorder;&token;=

Now, go on to the orders page and open the sample order, the link will be something like

http://bluecowcables.com/Haybail/index.php?tab=AdminOrders&id_order=1&vieworder&token;=f62930bu9214d96112339x567c0e9kq

after putting your site address and admin folder into my link, you need to cut and paste the security token from your order onto your link and then cut and paste the whole thing into your browser.

You should have this...

yourshop.fr/your-admin-folder/index.php?tab=AdminOrders&id_order=1&deleteorder&token;=f62930bu9214d96112339x567c0e9kq

You can change the "&id;_order=" value to the number of the order you wish to delete.


I hope this helps,
John Perkin
www.bluecowcables.com

Share this post


Link to post
Share on other sites
  • 0
[quote author="john.e.perkin" date="1249938947"]Got it, here's how you do it, you need this code... ...you need to be logged in too.

yourshop.fr/your-admin-folder/index.php?tab=AdminOrders&id_order=1&deleteorder;&token;=

Now, go on to the orders page and open the sample order, the link will be something like

http://bluecowcables.com/Haybail/index.php?tab=AdminOrders&id_order=1&vieworder;&token;=f62930bu9214d96112339x567c0e9kq

after putting your site address and admin folder into my link, you need to cut and paste the security token from your order onto your link and then cut and paste the whole thing into your browser.

You should have this...

yourshop.fr/your-admin-folder/index.php?tab=AdminOrders&id_order=1&deleteorder;&token;=f62930bu9214d96112339x567c0e9kq

You can change the "&id;_order=" value to the number of the order you wish to delete.


I hope this helps,
John Perkin
www.bluecowcables.com[/quote]

or just replace vieworder by deleteorder ;)
it works!

Share this post


Link to post
Share on other sites
  • 0
[quote author="Bruno Lévêque" date="1229420778"]Hi,

You can delete customers via your admin panel, you can also truncate MySQL tables:

[code]
TRUNCATE TABLE `ps_customer`;
TRUNCATE TABLE `ps_address`;
TRUNCATE TABLE `ps_orders`;
TRUNCATE TABLE `ps_order_detail`;
TRUNCATE TABLE `ps_order_discount`;
TRUNCATE TABLE `ps_order_history`;
TRUNCATE TABLE `ps_message`;
TRUNCATE TABLE `ps_cart`;
TRUNCATE TABLE `ps_cart_product`;
TRUNCATE TABLE `ps_cart_discount`;
[/code][/quote]

After I run this SQL command, all my data is succesfully deleted. But somehow, I can't create any customer again.

Anybody can help?

the message is:
There is 1 error :

1. an error occurred while creating your account


ps: I still run for my test site, so the customer was created by myself.

Share this post


Link to post
Share on other sites
  • 0
kesit: It's likely the script had an error, Try running it again and this time note if it has an error. If so, post that back here.


Sekuta was correct, it's far easier to change vieworder to deleteorder. I didn't understand him at first, so I'll make it real simple to help others out there:
1) Go to the Orders Tab
2) Click on an order
3) In your browser's address bar, you now have an address like this: http://www.yoursite.com/yourpath/youradminfolder/index.php?tab=AdminOrders&id_order=2&vieworder;&token;=8easdfc42a4c9176s8df7a1fe919ec65bc5
4) See vieworder in that address I showed you? Simply find that in your address bar and change vieworder to deleteorder and then press enter. Order is now gone!

Note: This forum adds semicolons (;) to the path I pasted here. Don't let that mess you up. There should be no ; in the address bar path.

Share this post


Link to post
Share on other sites
  • 0
@kyferez: may i know which script do you suggest to run again? is it the sql or creating account module?

if it's creating account modul, i already tried to run it again and again...but nothing change, still "an error occurred while creating your account" message

if it's the sql command, nothing faulty message:
TRUNCATE TABLE `ps_customer`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_address`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_orders`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_order_detail`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_order_discount`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_order_history`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_message`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_cart`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_cart_product`;# MySQL returned an empty result set (i.e. zero rows).

TRUNCATE TABLE `ps_cart_discount`;# MySQL returned an empty result set (i.e. zero rows).


If it help with a clue, when i try to register...this will be happened:
- ps_customer will successfully create data
- ps_cart will create data, but with wrong id_customer and/or id_guest


hope it'll help you to help me.....

thanks for reply

and sorry for thread starter since i just seem to hack your topic....

Share this post


Link to post
Share on other sites
  • 0
I seriously doubt this will fix it, but it's worth a try:
[code]
TRUNCATE TABLE `ps_customer`;
TRUNCATE TABLE `ps_address`;
TRUNCATE TABLE `ps_orders`;
TRUNCATE TABLE `ps_order_detail`;
TRUNCATE TABLE `ps_order_discount`;
TRUNCATE TABLE `ps_order_history`;
TRUNCATE TABLE `ps_message`;
TRUNCATE TABLE `ps_cart`;
TRUNCATE TABLE `ps_cart_product`;
TRUNCATE TABLE `ps_cart_discount`;
ALTER TABLE `ps_customer` AUTO_INCREMENT = 0;
ALTER TABLE `ps_address` AUTO_INCREMENT = 0;
ALTER TABLE `ps_orders` AUTO_INCREMENT = 0;
ALTER TABLE `ps_order_detail` AUTO_INCREMENT = 0;
ALTER TABLE `ps_order_discount` AUTO_INCREMENT = 0;
ALTER TABLE `ps_order_history` AUTO_INCREMENT = 0;
ALTER TABLE `ps_message` AUTO_INCREMENT = 0;
ALTER TABLE `ps_cart` AUTO_INCREMENT = 0;
ALTER TABLE `ps_cart_product` AUTO_INCREMENT = 0;
ALTER TABLE `ps_cart_discount` AUTO_INCREMENT = 0;
[/code]
If this still doesn't work, start a new thread stating what you did and the results so this one doesn't get too hijacked.

Share this post


Link to post
Share on other sites
  • 0
@kyferez...thanks for your help. unfortunately it doesn't fix my problem....but it's really give me hope..

i already post a new thread about this (if someone read this and think know the problem): http://www.prestashop.com/forums/viewthread/39109/help_installation___upgrade/unsolved_cant_add_new_customer_after_clearing_customer_database

--------edit-----------

thanks,
my problem is solved...
i have to add 1 more sql command:

TRUNCATE TABLE `ps_customer_group`;


thanks everyone...

Share this post


Link to post
Share on other sites
  • 0
I used the code here on in this thread and had the same problem. Googled and found a solution: truncate customer_group table. Hope it works for you to.

TRUNCATE TABLE `ps_customer_group`

Share this post


Link to post
Share on other sites
  • 0
Hi, sorry to hijack this thread, but i have a problem.

I had set up a few test customer accounts and when i was deleting them, i accidentally deleted a proper customers account.

Now when i try to add that customer back it keeps telling me that the email address has already been registered, is there any way of adding this customer back?

The account seems to be still there in the BO>Customers>Addresses tab and also the BO>Customers>Groups tab and also there is still parts in the BO>Customers>Carts tab aswell, but i cant seem to get the customer added again so they can log in

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×