Jump to content

Correct way to delete test orders


Recommended Posts

Ok everyone I have read so many topics here in the forums and everyone has used different ways to delete test orders from their databases so with that being said can someone please give me the correct way of doing this. If you do not know for a fact please do not answer. I need someone that has developer exp. here with prestashop because I am not going to screw my database up.

 

Thanks in advance

Clayton

Link to comment
Share on other sites

I know there are free and paid modules that make it easy, but without all that, it's really very simple. Go into your backoffice, click on Orders. Then click on a test order to view it. If you look up into your browser's address bar there is a long address there. You will see that vieworder is part of that long address. Just change vieworder to deleteorder and hit Enter. Bingo, test order is gone.

  • Like 2
Link to comment
Share on other sites

the issue with using the method above is 2 fold

 

1) it does not remove all traces of the order from the database. It only removes the main order information, however information about which products were a part of the order remains in the database

2) if the order that you delete was the most recent order, then when a new order arrives, the products from the deleted order will be combined with the new order.

 

So if you do not care about leaving behind those traces, AND you can manage to not delete the most recent order, then you technically should be fine.

Link to comment
Share on other sites

oh, if you are deleting all your test orders, then it would effect more than the first order

 

the reason for this, is Prestashop will re-use the id_order, essentially restarting at one. So if you had 5 test orders, whose id_order was 1 through 5, then the first 5 orders will take on the products from the old 5 test orders.

 

as others have mentioned, there are modules to delete orders. I suggest you do some research to find one, like this...

http://www.prestashop.com/forums/topic/191037-free-delete-orders-module/

Link to comment
Share on other sites

IMHO the following would be the correct way. WARNING: if you have any 'other' modules that build their own information from orders..the results can be unpredictable and...you should back up your db before deleting any orders.

 

admingfolder/tabs/AdminOrders.php

 

add this line of code: $this->delete = true;

then visit your admin orders tab, you will then see the delete trashcan...

 

public function __construct()
{
 $this->delete = true;
}

  • Like 2
Link to comment
Share on other sites

IMHO the following would be the correct way. WARNING: if you have any 'other' modules that build their own information from orders..the results can be unpredictable and...you should back up your db before deleting any orders.

 

admingfolder/tabs/AdminOrders.php

 

add this line of code: $this->delete = true;

then visit your admin orders tab, you will then see the delete trashcan...

 

public function __construct()
{
 $this->delete = true;
}

 

how about PS 1.5.x ? it is possible?

Link to comment
Share on other sites

:) this is the exact reason I opened this post because I never could get a true grasp on what was the correct way but I am not saying none of the ways are wrong by any means. I use 1.4.9 and will try elpatrons way and no, I do not use any other modules to delete test orders now. I am trying to keep modules to a minimum if I can help it only cause there's always so many updates and it will really become a pain in the you know what lol.

 

Thank you all for all the feedback as it has been very helpful

Edited by clayton29657 (see edit history)
Link to comment
Share on other sites

using the delete trash can or just entering the deleteorders in the URL equate to the same thing, and will result in orphaned records. you either need skills and knowledge with the database to correctly delete all orders, or just use a module that already provides that functionality.

  • Like 1
Link to comment
Share on other sites

I have seen so many modules that 3rd party developers make for this so can you all give me one that you know will work. I have some techs at my disposal to work on my site. I just want to know what can or can't be done before i approach them with this issue.

 

Thank you bellini13 you're always a huge help and asset to the forums :)

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • 6 months later...

I use a free module to do this and everything works fine but the only problem for me is, that if i made 20 test orders for example and i delete them all, the new order ID number won't start with 1 again but 21 instead.

 

Is there a way to solve this somehow? I'd like my orders to start with #1 again.

 

Thank you and best regards,

Housy

Edited by Housy (see edit history)
Link to comment
Share on other sites

Well, here is a solution  :)

 

Just go to your phpmyadmin, find table "ps_order" and "ps_order_details", truncate both and you're new orders will begin with number #1 again.

 

Hope this helps   B) 

 

I use a free module to do this and everything works fine but the only problem for me is, that if i made 20 test orders for example and i delete them all, the new order ID number won't start with 1 again but 21 instead.

 

Is there a way to solve this somehow? I'd like my orders to start with #1 again.

 

Thank you and best regards,

Housy

Edited by Housy (see edit history)
Link to comment
Share on other sites

Which tables should i truncate beside those two, so i would avoid problems?

 

except that there are still ghost records in other tables, so when you re-create orders starting from 1 again, you will eventually have these ghost records joined to these new orders... that would likely not turn out well

Link to comment
Share on other sites

  • 5 years later...

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
×
×
  • Create New...