PrestaShop Forums: [Solved] Deleting test orders - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


[Solved] Deleting test orders


[Solved] Deleting test orders

#1 debugginglife

    PrestaShop Apprentice

  • 25 Oct 2008
  • Members
  • PipPip
  • 26 posts
  • Location:Ankara/Turkey

Posted 16 November 2008 - 01:39 PM

Hi,

I set up prestashop and modified according to the needs of our business. However, during modification i made too many test orders (more than 100). Thus, i want to delete orders without any trace or causing misbehavior in scripts. Database index number can be at its last value there is no problem with index. Could you offer me a way ?


Regards,
Ali

#2 debugginglife

    PrestaShop Apprentice

  • 25 Oct 2008
  • Members
  • PipPip
  • 26 posts
  • Location:Ankara/Turkey

Posted 21 November 2008 - 08:23 PM

I have been looking for an answer from an expert

#3 Matthieu Biart

    PrestaShop Fanatic

  • 03 Aug 2007
  • Members
  • PipPipPipPip
  • 1166 posts
  • Location:Paris

Posted 21 November 2008 - 08:50 PM

Hi debugginglife!

We already replied thousand of time to that question.
Please do a search inside the forum.
Matthieu BiartCore developer | Développeur coeurPrestaShop
Help PrestaShop, make a donation! • Aidez la communauté, soumettez vos rapports de bug uniquement en anglais

#4 debugginglife

    PrestaShop Apprentice

  • 25 Oct 2008
  • Members
  • PipPip
  • 26 posts
  • Location:Ankara/Turkey

Posted 21 November 2008 - 09:47 PM

Hi,

As a conclusion from the previous messages, it is obvious that there is no X button for deleting order in back office. However, i am looking for some database editing ( with a tool like phpmyadmin or else), here can be some experts who did such changes before. If i delete both customer and its orders from database, will the script misbehave?

Not being able to delete an order is a good feature to prevent the store form theft or lose of information, but there could be a manual method to remove test orders or bad orders ( like orders from some hacking attempts)

#5 spott

    PrestaShop Apprentice

  • 23 Jul 2008
  • Members
  • PipPip
  • 437 posts
  • Location:Estonia

Posted 23 November 2008 - 09:18 AM

First - all orders need to stored! This is like accounting program, where You need to store all information. When You don't need this order, then You can cancel that.

But when You still want delete orders - then You can do that at database. Look tables orders and order* tables.
The Box said Windows XP or better!
So I installed Linux

PrestaPortal- Presta themes, modules, tricks etc

#6 macandcheese

    PrestaShop Apprentice

  • 13 Sep 2008
  • Members
  • PipPip
  • 45 posts

Posted 25 November 2008 - 02:02 PM

i want to delete test orders too. .what table in mysql??

#7 d0m1n1k

    PrestaShop Apprentice

  • 19 Mar 2008
  • Members
  • PipPip
  • 284 posts
  • Location:Austria

Posted 26 November 2008 - 12:22 PM

delete from ps_cart;
delete from ps_cart_product;
delete from ps_message;
delete from ps_order_detail;
delete from ps_order_history;
delete from ps_orders;


i'm not responsible if it doesn't work as expected.
you must create a DB backup before executing this sql commands.

but:
worked for me ;)

#8 kyrre

    PrestaShop Apprentice

  • 24 Jan 2009
  • Members
  • PipPip
  • 52 posts
  • Location:Fetsund, Norway

Posted 30 January 2009 - 11:41 AM

From 1227297010:

Hi debugginglife!

We already replied thousand of time to that question.
Please do a search inside the forum.


Sorry for bringing up this old thread - but I just had to comment.

You say "thousand of time"? That's the overstatement of the decade. I search for "delete order" and got 72 hits - and four of them was directly related to my search.

If only people who know where to find information replyed, the web would be faster. If you don't have anything useful to say - don't say it!

The challenge with forums like this is that there are people from all over the world using it. The spoken languages are many, and not all understand or writes english (or french for that matter) that well - me included!

A little help and understanding is all that is needed for people to smile. And this software is all about smiling, because it's GREAT! :)
Regards
Kyrre

#9 MahmutGulerce

    PrestaShop Addict

  • 18 Mar 2009
  • Moderators
  • 515 posts
  • Location:Türkiye

Posted 23 May 2009 - 05:27 PM

u can use this sql querry but before that you must create a backup

TRUNCATE `ps_orders`;
TRUNCATE `ps_order_customization_return`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_discount`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_return`;
TRUNCATE `ps_order_return_detail`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_slip`;
TRUNCATE `ps_order_slip_detail`;
TRUNCATE `ps_order_state`;
TRUNCATE `ps_order_state_lang`;

warning this deletes all orders and dont expand which is real order which is for test.

#10 shaiss

    PrestaShop Apprentice

  • 17 Jul 2009
  • Members
  • PipPip
  • 67 posts
  • Location:Brea, CA

Posted 05 August 2009 - 09:01 PM

Thank you mahmutta, that worked for me!
After going back to do some more test orders I received "invalid order state" in the store front, and no orders show in the BO.

Thats because the SQL query above empties 2 important tables

TRUNCATE `ps_order_state`;
TRUNCATE `ps_order_state_lang`;


I'm still testing this, but I'd also add the below to the query above
 TRUNCATE `ps_message`;


And remember if you get a mysql error, check your table prefix!

#11 shaiss

    PrestaShop Apprentice

  • 17 Jul 2009
  • Members
  • PipPip
  • 67 posts
  • Location:Brea, CA

Posted 05 August 2009 - 10:13 PM

Sorry for a duplicate post, but heres the SQL query that does work, tested 10 times over

TRUNCATE `ps_orders`;
TRUNCATE `ps_order_customization_return`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_discount`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_return`;
TRUNCATE `ps_order_return_detail`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_slip`;
TRUNCATE `ps_order_slip_detail`;
TRUNCATE `ps_message`;
TRUNCATE `ps_cart`;
TRUNCATE `ps_cart_product`;


as mahmutta said, this will delete ALL ORDERS!!!
this will NOT delete customers. but that can be done through the BO.

Also, remeber that some modules use there own tables with order id relations, so be sure to check on those.

#12 shaiss

    PrestaShop Apprentice

  • 17 Jul 2009
  • Members
  • PipPip
  • 67 posts
  • Location:Brea, CA

Posted 07 August 2009 - 06:48 PM

I put together a module just for this purpose
http://www.prestasho...ewthread/24710/

#13 MahmutGulerce

    PrestaShop Addict

  • 18 Mar 2009
  • Moderators
  • 515 posts
  • Location:Türkiye

Posted 04 May 2010 - 07:22 AM

OK
1-) Open /prestashop site root/admin/tabs/AdminOrders.php via your fav editor.
2-) Find this code about 25th line
        $this->colorOnBackground = true;

3-) After this add this line
$this->delete = true;


Thats all
Now you can delete any of orders at back office regular ;)
i recomend add // comment start of the added line after delete


#14 jarane

    PrestaShop Newbie

  • 04 Oct 2010
  • Members
  • Pip
  • 7 posts

Posted 09 October 2010 - 07:10 PM

For Presta 1.3.1 you have to use

TRUNCATE `ps_orders`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_discount`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_return`;
TRUNCATE `ps_order_return_detail`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_slip`;
TRUNCATE `ps_order_slip_detail`;
TRUNCATE `ps_message`;
TRUNCATE `ps_cart`;
TRUNCATE `ps_cart_product`;


Beacuse ps_order_customization_return doesn't exist.

#15 pv

    PrestaShop Newbie

  • 13 Aug 2010
  • Members
  • Pip
  • 3 posts

Posted 12 October 2010 - 03:03 PM

to delete one order at at time...

Click on one of the orders ( in the back office) and replace the parameters “vieworder” with “deleteorder” from the url

For example

http://yourdomain.co...0d828eb3f2a8621

Change it to:

http://yourdomain.co...0d828eb3f2a8621

Works like a charm!

#16 peanut

    PrestaShop Apprentice

  • 17 Oct 2010
  • Members
  • PipPip
  • 112 posts

Posted 21 October 2010 - 12:12 PM

From 1286892210:

to delete one order at at time...

Click on one of the orders ( in the back office) and replace the parameters “vieworder” with “deleteorder” from the url

For example

http://yourdomain.co...0d828eb3f2a8621

Change it to:

http://yourdomain.co...0d828eb3f2a8621

Works like a charm!


Thank you soooo much..I was getting worried as I kept reading this thread but your simple trick made my life so easy!! Yay...thanks! :-)

#17 Pippo3000

    PrestaShop Apprentice

  • 22 Aug 2010
  • Members
  • PipPip
  • 390 posts

Posted 21 October 2010 - 01:02 PM

From 1286892210:


Works like a charm!


affirmative, pv. that's been one of the best and easiest tricks I've ever seen so far. greatly appreciated.
phil
PS v1.3.2.x

#18 Clothahump

    PrestaShop Newbie

  • 12 Oct 2010
  • Members
  • Pip
  • 11 posts

Posted 25 October 2010 - 06:37 AM

Maybe a simple Delete button would work well :roll:

#19 krum

    PrestaShop Newbie

  • 07 Nov 2010
  • Members
  • Pip
  • 1 posts

Posted 07 November 2010 - 05:09 PM

I tried the tip to alter the vieworder url which seems to work great. My question is, with this tip is anyone concerned with the fact that it only seems to truncate that record from ps_orders and does not affect the corresponding related tables ala:

`ps_order_detail`;
`ps_order_history`;
`ps_message`;
`ps_cart`;
`ps_cart_product`;

Is it recommended to truncate these tables manually anyway when you delete an order or can you leave as is? Also, are there any issues with auto_ids to truncating these tables?

#20 nero_77

    PrestaShop Apprentice

  • 14 Jan 2010
  • Members
  • PipPip
  • 51 posts

Posted 06 December 2010 - 04:01 PM

Great thread, very useful thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users