Jump to content

[Solved] Deleting test orders


Recommended Posts

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

  • Like 1
Link to comment
Share on other sites

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)

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...

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.

Link to comment
Share on other sites

  • 2 months later...

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!

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

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

  • Like 7
Link to comment
Share on other sites

  • 5 months later...

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.

Link to comment
Share on other sites

  • 2 weeks later...
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.com/admin/index.php?tab=AdminOrders&id_order=7&vieworder;&token;=798dfd720021761c80d828eb3f2a8621

Change it to:

http://yourdomain.com/admin/index.php?tab=AdminOrders&id_order=7&deleteorder;&token;=798dfd720021761c80d828eb3f2a8621

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! :-)
  • Like 6
Link to comment
Share on other sites

  • 2 weeks later...

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?

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
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



Perfect! Thnx
  • Like 3
Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...
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



WORKS!!!! thanks a lot
Link to comment
Share on other sites

  • 2 months later...

@Gipielle ,@dabyd, @the_farmer, @sakrafanas, @nero_77
Thanks. I'm glad it had worked.

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?


It isnt necessary. The recomended solution is "edit admin-orders tab". Because delete function uses prestashop native class functions so it clears all related table rows in other tables as well.

Other hand, i recomend the "truncate" query for use only once. It deletes all rows without any criterion. You cant use it again and again. For example all collected cart items will be deleted.

Regards.
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 5 months later...
  • 2 months later...
  • 4 weeks later...
  • 1 month later...
  • 1 month later...

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

I only did not understand when you say "i recomend add // comment start of the added line after delete ".

What line have to be commented after delete? After the delete line there is a long line starting with $this->_select = '. Is that line that I should comment? See the line bellow:

 

$this->_select = '

a.id_order AS id_pdf,

CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,

osl.`name` AS `osname`,

os.`color`,

IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new,

(SELECT COUNT(od.`id_order`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number';

Link to comment
Share on other sites

I only did not understand when you say "i recomend add // comment start of the added line after delete ".

What line have to be commented after delete? After the delete line there is a long line starting with $this->_select = '. Is that line that I should comment? See the line bellow:

 

$this->_select = '

a.id_order AS id_pdf,

CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,

osl.`name` AS `osname`,

os.`color`,

IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new,

(SELECT COUNT(od.`id_order`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number';

 

I recomend // because it will be simple when you want to change back. It is not important. You also can delete whole line.

Link to comment
Share on other sites

I recomend // because it will be simple when you want to change back. It is not important. You also can delete whole line.

What do you mean with CHANGE BACK? If I comment the line, after deleting an order, is it possible to UNDO the delete?

Is only the line bellow the delete line that should be commented?

Thanks a lot!

Link to comment
Share on other sites

What do you mean with CHANGE BACK? If I comment the line, after deleting an order, is it possible to UNDO the delete?

Is only the line bellow the delete line that should be commented?

Thanks a lot!

Pantera

You can not UNDO after you delete an order. When you use // at the begining of a line, your PHP compiler will skip this line. Makes nothing about this line.

 

Other hand as a typed on my first message:

It is really serious risk to use delete function for orders. Because Order Class is an extend of ObjectModel Class.

When you use delete function of ObjectModel, all rows about the order will be deleted at all tables which defined at Order class.

So you can UNDO after delete.

 

I simply described that:

How you make orders deletable than how to turn of delete function.

 

You can delete orders by adding this line

$this->delete = true;

 

After delete some orders you may want to turn of delete function due to delete orders by an oversight

 

You can turn of deleting by adding // like

//$this->delete = true

 

Or remove $this->delete = true;

Link to comment
Share on other sites

Pantera

You can not UNDO after you delete an order. When you use // at the begining of a line, your PHP compiler will skip this line. Makes nothing about this line.

 

Other hand as a typed on my first message:

It is really serious risk to use delete function for orders. Because Order Class is an extend of ObjectModel Class.

When you use delete function of ObjectModel, all rows about the order will be deleted at all tables which defined at Order class.

So you can UNDO after delete.

 

I simply described that:

How you make orders deletable than how to turn of delete function.

 

You can delete orders by adding this line

$this->delete = true;

 

After delete some orders you may want to turn of delete function due to delete orders by an oversight

 

You can turn of deleting by adding // like

//$this->delete = true

 

Or remove $this->delete = true;

Thanks for the answer. I'm observing that even after deleting an order, the DETAILS of that order are not deleted. They remain in the table PS_ORDER_DETAIL.

After deleting an order using the bottom that is added after inserting the line of code that you suggest, seems that is still necessary to clean some tables.

What do you think?

Link to comment
Share on other sites

Thanks for the answer. I'm observing that even after deleting an order, the DETAILS of that order are not deleted. They remain in the table PS_ORDER_DETAIL.

After deleting an order using the bottom that is added after inserting the line of code that you suggest, seems that is still necessary to clean some tables.

What do you think?

 

I can describe that

Order Class is an Extend of ObjectModel but all related tables not defined.

Only orders table defined

protected $tables = array ('orders');

 

So if you want to delete all related tables you can modify this line like (But I never recomend this)

protected $tables = array ('order_credit_data', 
'order_detail', 
'order_discount', 
'order_history', 
'order_message', 
'order_message_lang', 
'order_return', 
'order_return_detail', 
'order_return_state', 
'order_return_state_lang', 
'order_slip', 
'order_slip_detail', 
'order_state', 
'order_state_lang');

Link to comment
Share on other sites

  • 4 months later...

You need to get this folks who ask for a DELETE button. If they create one, the shop software will be illegal in the entire EU as a base for your business. It is illegal to be able to remove payment or ordering information and/or invoice information from a business.

Link to comment
Share on other sites

  • 4 weeks later...

hey! for PS 1.5 I have found this FREE module here, I try and works. Took me 5 (real) minutes to install and delete all test orders

 

you will have a delete button at the end of the order line in the BO and can do test orders between real orders and then delete

 

Cool, Free!!!

 

http://catalogo-onlinersi.net/en/back-office-prestashop-modules/160-delete-orders-prestashop-module.html

Link to comment
Share on other sites

  • 2 months later...

hey there while the previous comments may work in older versions of prestashop (i have not tested them)

 

they do not work for prestashop 1.5*

in order to get the delete order icon in version 1.5* you need to add the following to

FILE: WEB_ROOT/controllers/admin/AdminOrdersController.php

public function __construct()
{
 $this->table = 'order';
 $this->className = 'Order';
 $this->lang = false;
 $this->addRowAction('view');
 [color=#0000ff]$this->addRowAction('delete');[/color]
 $this->explicitSelect = true;

NOTE the $this->addRowAction('delete'); is added to the constructor

the allowed action (as fare as i now) 'view', 'edit', 'delete', 'duplicate'

 

Regards And happy coding

  • Like 6
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

It amazes me why such a simple feature takes so much discussion and still it's not implemented in the latest version.

 

Are PRESTASHOP engineers listening to users AT ALL??

Sorry to get involved so late, but it's doing my head in. I'm half way through page 2 and I've already seen multiple people demand that Prestashop add this feature in.

 

Pepfoto gave a very clear explanation as to why they cannot do this:

You need to get this folks who ask for a DELETE button. If they create one, the shop software will be illegal in the entire EU as a base for your business. It is illegal to be able to remove payment or ordering information and/or invoice information from a business.

 

As a business you should not be deleting records of any orders or invoices, this is how fraud starts... of course I'm aware you could be keeping the information in other places, but it would be illegal to offer you the ability to delete this information.

 

Having said that, I'm aware that most of you are only trying to delete the sample data and not your own sales data.

SO HERES A DEAD EASY SOLUTION

For that, I have been using this solution:

http://hassadee.com/...prestashop-1-5/

 

It allows you to just add one line of code to the core code, that then provides a delete button next to the orders. You can then delete the orders by pressing that button, then go back in to the core code and remove that one line you just added, easier and safer that editing the database directly.

 

JD

Edited by jd.creative (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 3 weeks later...

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!

 

Quick and easy fix.

Thank you!! I have been trying to get rid of the sample order that was installed with prestashop for a month.

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

hey there while the previous comments may work in older versions of prestashop (i have not tested them)

 

they do not work for prestashop 1.5*

in order to get the delete order icon in version 1.5* you need to add the following to

FILE: WEB_ROOT/controllers/admin/AdminOrdersController.php

public function __construct()
{
 $this->table = 'order';
 $this->className = 'Order';
 $this->lang = false;
 $this->addRowAction('view');
 [color=#0000ff]$this->addRowAction('delete');[/color]
 $this->explicitSelect = true;

NOTE the $this->addRowAction('delete'); is added to the constructor

the allowed action (as fare as i now) 'view', 'edit', 'delete', 'duplicate'

 

Regards And happy coding

 

This is just awesome and the simplest fix...

 

Excellent... thanks for sharing....

 

Now I can delete individual orders too....

 

Deleting orders could not get any more easier than this....

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

You can also add

$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Would you like to delete the selected items?')));

 

So you can delete multiple orders.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

It's possible that whit this large thread this is a stupid comment, but in my module dashboard on version 1.5.4.1 I have a module called "Prestashop Cleaner" developed by Prestashop, that do this work on the fly...

 

With this module you can:

 

- Delete all catalog data, without possible rollback: products, features, categories, tags, images, prices, attachments, scenes, stocks, attribute groups and values, manufacturers, suppliers...

 

- Delete all data of the orders and customers without possible rollback: customers, carts, orders, connections, guests, messages, stats...

 

The module advert that You can not roolback. Use with care.

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

  • 1 month later...

vekia is tne man (i was pv) now jc due to forgetting my user name... or login or something.  check out the prestshop free modules in the forum he has compiled and tested. There is a great mod there for deleting orders now by vekia!   http://www.prestashop.com/forums/topic/191037-free-delete-orders-module/

 

 

http://www.prestashop.com/forums/topic/233442-free-modules-list-only-valuable-and-proven-solutions-21112013/

 

highly recommended!

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

  • 4 weeks later...
  • 4 weeks later...

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

phil

Nice little trick, for sure.

Still have to fix your quantities though - it doesn't seem to undo the inventory decrement... (Not difficult to do manually though)

Like it!

Link to comment
Share on other sites

  • 3 weeks later...

Sorry to get involved so late, but it's doing my head in. I'm half way through page 2 and I've already seen multiple people demand that Prestashop add this feature in.

 

Pepfoto gave a very clear explanation as to why they cannot do this:

 

 

As a business you should not be deleting records of any orders or invoices, this is how fraud starts... of course I'm aware you could be keeping the information in other places, but it would be illegal to offer you the ability to delete this information.

 

Having said that, I'm aware that most of you are only trying to delete the sample data and not your own sales data.

SO HERES A DEAD EASY SOLUTION

For that, I have been using this solution:

http://hassadee.com/...prestashop-1-5/

 

It allows you to just add one line of code to the core code, that then provides a delete button next to the orders. You can then delete the orders by pressing that button, then go back in to the core code and remove that one line you just added, easier and safer that editing the database directly.

 

JD

 

I wouldn't use this solution.

It made many problems to me.

This solution delete the order only from `ps_orders` table but the order information stays in many other tables.

Example:

I deleted order number: 4 - with 3 products

Then I placed new order with 3 products and presta gave it id ...: 4

When I looked in orders tab the new order had 6 products instead of 3.

That was because information from old number 4 order wasn't deleted when I deleted order with described method.

So I don't recommend this solution.

 

I'm using this module after a few modifications.

Link to comment
Share on other sites

I deleted order number: 4 - with 3 products

Then I placed new order with 3 products and presta gave it id ...: 4

When I looked in orders tab the new order had 6 products instead of 3.

That was because information from old number 4 order wasn't deleted when I deleted order with described method.

So I don't recommend this solution.

 

I'm using this module after a few modifications.

This is a surprising issue. In my 25 years of dev work I have never allowed a customer/product/order entry to *reuse* indexes. This is (was?) rule 101 of database development. We always kept latest indexes in a seperate DB and incremented by 1 on a new record. Very odd that it is allowed. 

 

For mine, I am setting up a brand new instance of PS now and I have lots of orders being created with payment integration being tested. Do I now need to go through every order and cancel implicitly because I can't batch delete? Notwithstanding I will have legacy test orders sitting for the lifespan of this package?

 

Comments regarding it's not allowed due to legality mentioned way back are somewhat moot. 1) It can't be illegal nor wrong to remove *test* data as no corresponding - auditable - transaction process is linked and 2) any sql jockey with an IQ greater than 10 can edit the database anyway.  I see there is a module for "free" with embedded ads to purchase a "better version" which also makes this "potential for fraud" moot anyway.

 

Which is what this whole thread was about really... Deleting TEST data. Seems a very simple and common problem requiring a rather complex and ambiguous solution tbh.

 

If it needs a hack or a module for a relatively simple feature, it's bad imho.

 

Now excuse me, I'm off to write and test sql scripts to kill the DB test data prior to going live.... Sad...

Link to comment
Share on other sites

prestashop has got module named pscleaner

this simple addon removes all "test" data (remove orders and reset auto_increment values), so you can run with vanilla shop then. it's a module installed with ps by default, no hidden fees, no payment etc.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

due to the consistency of the database, prestashop has got different feature: disabling voucher.

 

but in fact, tehre is module to clean database named PS CLEANER, but it's useful only when you want to remove test orders in bulk (all of them)

Link to comment
Share on other sites

  • 1 month later...

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.com/admin/index.php?tab=AdminOrders&id_order=7&vieworder&token;=798dfd720021761c80d828eb3f2a8621

 

Change it to:

 

http://yourdomain.com/admin/index.php?tab=AdminOrders&id_order=7&deleteorder&token;=798dfd720021761c80d828eb3f2a8621

 

Works like a charm!

 

 

edit....

 

looks like ps forums is blocking html or something here now..

 

check out these free modules listed at http://www.prestashop.com/forums/topic/233442-free-modules-list-only-valuable-and-proven-solutions-21112013/ listed by vekia

 

there are 2 solutions listed under

Catalog, Orders, Products etc. management in BO

 

Thanks, PV! You're the man! The damn test orders were messing up my dashboard's stats and accounting.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Holy Confusion Batman!!!

 

1) click an order in B/O and change URL from "vieworder" to "deleteorder"

 

or

 

2) some coding changes to order.php

 

or

 

3) buy a module to delete orders

 

or

 

4) do nothing!  just cancel them and "fuggetaboutit"!

 

 

What to do, what to do?

 

a) I only want to delete test orders and I do not want to mess up my database. 

 

B) I have admin staff processing orders, so i don't want a "delete" function available to them, or things could get really messed up.

 

What to do?  What to do?

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Most people using Prestashop are from Europe, which have annoying nanny state policies.  One of these, is that you are not allowed to have software that allows you to delete orders (like if that is really going to slow down real criminals).

 

I am from Canada, and here we can delete orders until the cows come home without fear of prosecution (if we are deleting them legitimately) [well maybe not in Quebec].

 

I guess we need two versions of Prestashop.  Prestashop-NS (Nanny State) and Prestashop-FW (Free World) :)

  • Like 2
Link to comment
Share on other sites

Most people using Prestashop are from Europe, which have annoying nanny state policies.  One of these, is that you are not allowed to have software that allows you to delete orders (like if that is really going to slow down real criminals).

 

I am from Canada, and here we can delete orders until the cows come home without fear of prosecution (if we are deleting them legitimately) [well maybe not in Quebec].

 

I guess we need two versions of Prestashop.  Prestashop-NS (Nanny State) and Prestashop-FW (Free World) :)

 

Made my Monday... laughed my head off!  I am from Canada as well, so I even understood the Quebec joke.

 

Hope no one was offended, and understood the humour with which (I believe) it was intended!

 

=> 2 Versions would be best, or one version, that adapts to the country it is installed in.

=> the way shipping levels are calculated, based on prices INCLUDING TAX is also a big problem!  Here, it's "before tax".

 

Anyway, on a fresh install, I see that Prestashop now has a MODULE called Prestashop Cleaner to get rid of the sample data.  A nice touch!  I used it.  It works well, but left a few remnants of the sample data, which I deleted manually on my admin.  But thankfully it did delete the sampler orders!!!

 

Link to comment
Share on other sites

  • 2 months later...

I think vieworder to delete order works best.

The "Delete orders" module available for doing this doesn't work well. It was deleting order return statuses(I don't see the reason to do this), and it is not deleting entries from order_invoices table(which infact are related to order entities and should be deleted in my opinion, because they can cause problems in the application later).

 

As ussual, we also had lot of test orders in our site to delete. So I wrote a simple javascript snippet to delete all orders automatically using "vieworder-deleteorder" URL conversion technique.

I'm sharing the script here: Please backup your database before trying to delete orders in any way. There is no standard way and none of these are guaranteed to be error free.

PS: I have written this for Prestashop 1.5.6.1 and it is not tested in any other versions.

Login to Back office and open Orders option from Orders menu to see list of orders.

 

Execute the following javascript code in that page to delete all orders displayed in current page.

I used firebug console to do this on our site, which is the quickest way I know.

The script will start deleting orders one by one in background until everything on current page is deleted. Leave the script there for sometime and allow it to finish.

Of course, you can see progress of the process also inside the firebug console.

var AllLinks = [];

$('table.table_grid tbody .table.order tbody tr').each(function(){
   var click = $(this).find('td:eq(1)').attr('onclick');
   var parts = click.split(' = ');
   var link = parts[1];
   link = link.replace(/'/g,"");
  link = link.replace(/vieworder/,"deleteorder");
  AllLinks.push(link);
});
console.log(AllLinks);

function ajax_delete1(){
 url = AllLinks.pop();
 if(url){
      $.get(url,function(){
        ajax_delete1();
      });
 }
 
}
ajax_delete1();
Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...

In 1.6 add

$this->addRowAction('delete');

to controllers/Admin/AdminOrderControllers to line 51 (near the other 'addRowAction') for deleting single order.

 

for bulk deletion change controllers/Admin/AdminOrderControllers line 190

'updateOrderStatus' => array('text' => $this->l('Change Order Status'), 'icon' => 'icon-refresh')

to

'updateOrderStatus' => array('text' => $this->l('Change Order Status'), 'icon' => 'icon-refresh'),
'delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'),'icon' => 'icon-trash')
  • Like 4
Link to comment
Share on other sites

I do want to say it again and wont get tired thank you so much for this software/product it is the best i have come across after several years of working with it has come a long way but anyways get to the point here, only leaving a comment to say thank you to PV after looking for several hours i found this and just like that worked great thank you friend was really easy. And also want to say i could not agree with DEBUGGINGLIFE any more it is very true and not this forum but many out there people just comment about 100 things except the one thing we all are here asking for, if you don't the answer to the question then keep your comments to your self, yes we can all give our input on something but don't waste others time with silly stuff, anyways thanks again to each and everyone out there that supports this.

Link to comment
Share on other sites

  • 2 weeks later...

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.com/admin/index.php?tab=AdminOrders&id_order=7&vieworder&token;=798dfd720021761c80d828eb3f2a8621

 

Change it to:

 

http://yourdomain.com/admin/index.php?tab=AdminOrders&id_order=7&deleteorder&token;=798dfd720021761c80d828eb3f2a8621

 

Works like a charm!

 

 

edit....

 

looks like ps forums is blocking html or something here now..

 

check out these free modules listed at http://www.prestashop.com/forums/topic/233442-free-modules-list-only-valuable-and-proven-solutions-21112013/ listed by vekia

 

there are 2 solutions listed under

Catalog, Orders, Products etc. management in BO

You, Sir, are a genius. Works like a charm. Thank you.

  • Like 1
Link to comment
Share on other sites

Yeah, a charm until you find out down the road that it was done incorrectly.  only the orders table is affected, but there are a whole slew of related tables that should be modified as well.

 

One of the many reasons I today decided to abandon my work with PS for now.  I either have to commit to fixing PS by doing what they won't (support, sensible functionality) which I have no time for right now, or else move on to some real software.

Link to comment
Share on other sites

  • 1 month later...

Hi everyone, best solution is instant delete rows in database. 

(Prestashop version 1.6.x)

 

1. For every order set state "canceled". For return goods to stock.

 

2. In database delete those tables:

ps_orders
ps_order_carrier
ps_order_cart_rule
ps_order_detail
ps_order_detail_tax
ps_order_history
ps_order_invoice
ps_order_invoice_payment
ps_order_invoice_tax
ps_order_message
ps_order_message_lang
ps_order_payment

3. Last step is set "1" value for auto_increment for tables above that has set option auto_increment of course.

 

That is it :)

Link to comment
Share on other sites

  • 2 months later...

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.com/admin/index.php?tab=AdminOrders&id_order=7&vieworder&token;=798dfd720021761c80d828eb3f2a8621

 

Change it to:

 

http://yourdomain.com/admin/index.php?tab=AdminOrders&id_order=7&deleteorder&token;=798dfd720021761c80d828eb3f2a8621

 

Works like a charm!

Thanks, really like a charm :)

 

edit....

 

looks like ps forums is blocking html or something here now..

 

check out these free modules listed at http://www.prestashop.com/forums/topic/233442-free-modules-list-only-valuable-and-proven-solutions-21112013/ listed by vekia

 

there are 2 solutions listed under

Catalog, Orders, Products etc. management in BO

Link to comment
Share on other sites

  • 1 month later...

Hey, that's great!  And it only took 7 years and 2 months to solve this issue.

 

I'm not detracting from your efforts.  I'm pointing out [one of] the reasons people should run for the hills when considering this web application for use with their business, where they may need faster response times than the average life of a [spam-filter].

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

PrestaShop™ 1.5.6.2

 

controllers\admin\AdminOrdersController.php

 

Add to under : $this->addRowAction('view');

       
       

        $this->addRowAction('delete');
        $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

This worked well for me in PS 1.6.1.4.

Thanks for making these instructions clear and simple.

Nik

PrestaShop™ 1.5.6.2

 

controllers\admin\AdminOrdersController.php

 

Add to under : $this->addRowAction('view');

       
       

        $this->addRowAction('delete');
        $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));

Link to comment
Share on other sites

The method with $this->addRowAction('delete'); might seem to work at first glance because it lets you delete records from ps_orders table, but it actually lets you with a lot of junk data in other tables that refer to the order id.

Link to comment
Share on other sites

  • 3 weeks later...

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.com/admin/index.php?tab=AdminOrders&id_order=7&vieworder&token;=798dfd720021761c80d828eb3f2a8621

 

Change it to:

 

http://yourdomain.com/admin/index.php?tab=AdminOrders&id_order=7&deleteorder&token;=798dfd720021761c80d828eb3f2a8621

 

Works like a charm!

 

 

edit....

 

looks like ps forums is blocking html or something here now..

 

check out these free modules listed at http://www.prestashop.com/forums/topic/233442-free-modules-list-only-valuable-and-proven-solutions-21112013/ listed by vekia

 

there are 2 solutions listed under

Catalog, Orders, Products etc. management in BO

 

 

Excellent suggestion that still works in 2016 

Who knows how to add this to the back office? Perhaps make it a drop down or check box?

 

 

 

Link to comment
Share on other sites

  • 2 months later...
×
×
  • Create New...