Jump to content
vekia

[Free] Delete Orders Module

Recommended Posts

Thank you for share this module, is very usefull, only one question, when delete the orders, the units deleted is restored to my stock? Regards

Share this post


Link to post
Share on other sites

Thank you for share this module, is very usefull, only one question, when delete the orders, the units deleted is restored to my stock? Regards

 

module will do this in next update. Now module only delete orders

Share this post


Link to post
Share on other sites

Thank you, I will wait for your next update, even for the payment module. regards

Share this post


Link to post
Share on other sites

Thank you, I will wait for your next update, even for the payment module. regards

 

check your message box for PM from me ;)

Share this post


Link to post
Share on other sites

want improvements? write it here and i will add it to module :)

Share this post


Link to post
Share on other sites

here is something wrong with picture in the first post

 

what do you mean by that? it works fine for me. Could you describe your problem with this picture?

Share this post


Link to post
Share on other sites

Just installed and looking good. Thanks

I wonder if this could be enhanced to be able to multiselect shopping cards for deletion?

Share this post


Link to post
Share on other sites

Just installed and looking good. Thanks

I wonder if this could be enhanced to be able to multiselect shopping cards for deletion?

 

hi,

 

what do you mean by "multiselect shopping cards for deletion" ?

 

you want to delete many orders by one mouse click?

Share this post


Link to post
Share on other sites

hi,

 

what do you mean by "multiselect shopping cards for deletion" ?

 

you want to delete many orders by one mouse click?

 

No, not orders - I am thinking of shopping carts that have been abandoned and not converted into an order

 

There was a hack in Ps1.4 where we could get tick boxes against shopping carts . This allowed us to select more than one shoppping cart at a time and delete them

Share this post


Link to post
Share on other sites

Hello Vekia ! Thanks for your module ! It's very important for me !

I have installed deleteordersfree_v1.1 and i made a few order tests. After that i deleted this orders via BO with your module.

I checked my DB (all tables beginning with ps_orders).

In the table ps_orders_tax, they have been not deleted.

It is ok if these items remained undeleted, or i must to delete them manually?

I use 1.4.8.2 and my shop is online (FishingNet)

Thank you again for your hard work !

Bogdan

Share this post


Link to post
Share on other sites

Hello Vekia ! Thanks for your module ! It's very important for me !

I have installed deleteordersfree_v1.1 and i made a few order tests. After that i deleted this orders via BO with your module.

I checked my DB (all tables beginning with ps_orders).

In the table ps_orders_tax, they have been not deleted.

It is ok if these items remained undeleted, or i must to delete them manually?

I use 1.4.8.2 and my shop is online (FishingNet)

Thank you again for your hard work !

Bogdan

 

sorry for the delay, i will write update for module - new version will eliminate the problem that you mentioned.

 

of course you can delete it manualy

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for share this module, is very usefull, only one question, when delete the orders, the units deleted is restored to my stock? Regards

 

To get the stock back, first of all, go to order details, delete from the list all products, and then delete de order.

By deleting the products you will get the stock restored.

 

 

Hope it helps to all!

Edited by KristianMM (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

...

now I can't print pdf files and i get an error: FPDF error: Undefined font: verdana B

 

It's impossible, because this module doesn't make any change in pdf generation and other features similar to PDF.

Share this post


Link to post
Share on other sites

true, module was not guilty, just the nationality of the administrator acc was set to english...

sryy my mistake

Share this post


Link to post
Share on other sites

tried in 1.5.2, all well

 

thanks vekia for this

 

loved the "orgullosamente desarrollado por..."

 

ps: I would love a version with a 'Delete all current orders' option. Better for mass elimination of fake orders before production. Anyway, thanks again.

Share this post


Link to post
Share on other sites

thanks, as you said - module works perfeclty in newest version of prestashop too

  • Like 1

Share this post


Link to post
Share on other sites

Great module, but with the old version there was also the possibility to cancel all orders and trucks in a single pass.

Share this post


Link to post
Share on other sites

in the next update I will add this feature :) it's on my TODO list ;)

  • Like 1

Share this post


Link to post
Share on other sites

Hello and sorry for my English,

 

I tried the free module in Prestashop 1.5.3.1 and removes the order without problems.

My question is:

If I delete an invoice with serial number "50", is the next order to buy will go on "50" or "51"?

 

I deleted an order with the number "50" and then I put the next bill begins with "50" again and says the following prestashop bill must begin with 51. So there will be a jump in the numbering series and I can have legal problems.

 

Thank you.

Share this post


Link to post
Share on other sites

unfortunately this module hasn't got feature to "restore" invoice counter, i will check module later, maybe it is possible to create it :-)

Share this post


Link to post
Share on other sites

I tried the module to delete the test orders and i found that it does not delete (or truncate) these tables in the database:

 

- ps_order_carrier

- ps_order_message

- ps_order_message_lang

 

I did not check, but in this case, it's possible that when registering next orders with same IDs, shows wrong carrier and shows old messages from other orders.

 

I will continue testing this module. I had a method to delete test orders with PS1.4 but it does not work with PS1.5

Share this post


Link to post
Share on other sites

hello thanks for your information

 

new order = always new id, so it isn't possible to show old messages in new order

 

i will update this module asap

Share this post


Link to post
Share on other sites

Hi Vekia,

I have a problem in the backoffice with shopping carts.

People make them with as a guest and then leave the store.

In 14 days I have 280+ shopping carts in the backoffice.

I downloaded the free version of your delete orders module but it only deletes orders from clients.

Does the Pro versio delete also non clients shopping carts?

 

Thanks

Share this post


Link to post
Share on other sites

hello,

 

thanks for your suggestion - it is suggestion for me

 

i will update this addon to delete the unwanted carts

 

regards

Share this post


Link to post
Share on other sites

I tried the module to delete the test orders and i found that it does not delete (or truncate) these tables in the database:

 

- ps_order_carrier

- ps_order_message

- ps_order_message_lang

 

I did not check, but in this case, it's possible that when registering next orders with same IDs, shows wrong carrier and shows old messages from other orders.

Sadly, you're right. After use this module I have a problem with carriers. (And probably some problems which I don't know at this time. Future can bring me some negative suprise.)

 

new order = always new id, so it isn't possible to show old messages in new order

Actually, prestashop works in a different way.

New order != new id.

BUT

New order == last free id.

 

Here's an example:

Situation 1. If we have orders 1, 2, 3, 4 and we delete order 2 then we have 1, 3, 4. In this situation new order will have number 5.

Situation 2. If we have orders 1, 2, 3, 4 and we delete order 4 then we have 1, 2, 3. In this situation new order will have number 4.

 

At this time using this module can cause horrible faults.

post-561877-0-41224000-1368170386_thumb.png

 

Is any solution which can help me to repair damages?

Should I remove records only from table "ps_order_carrier"?

 

Really sorry for my English.

Share this post


Link to post
Share on other sites

I can't agree.

id_order is a PRIMARY KEY with AUTO_INCREMENT

 

`id_order` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,

 

which mean that all entries in this field is UNIQUE and can't be doubled.

 

I reproduced your issue, and the effect is:

0wCGDBE.png

 

 

conclusion

 

id_order are ALWAYS unique and can't be doubled - even if you remove row.

Share this post


Link to post
Share on other sites

So how can you explain my problem?

I was having six test orders. I removed them all and then added one order.

 

This is how my "ps_orders" table look like now:

post-561877-0-03343600-1368181132_thumb.png

As you see "id_order" is 1.

 

And here you have some other screenshots from my database:

 

"ps_order_carrier" table:

post-561877-0-80883700-1368181603_thumb.png

 

"ps_order_detail_tax" table:

post-561877-0-30507400-1368181615_thumb.png

 

"ps_order_invoice" table:

post-561877-0-86168900-1368182130_thumb.png

 

"ps_order_invoice_payment" table:

post-561877-0-82567200-1368182233_thumb.png

Share this post


Link to post
Share on other sites

you removed them all by deleting them, or by TRUNCATE the table?

Share this post


Link to post
Share on other sites

i removed 5 order before:

0wCGDBE.png

 

here are other tables:

 

ps_order_carrier

illimgW.png

 

other tables look the same, id_order number is correct.

 

What prestashop version you use?

Share this post


Link to post
Share on other sites

when you go to the ps_order table settings

the id_order has got AUTO_INCREMENT ?

 

im going to check this on 1.5.3.1

Share this post


Link to post
Share on other sites

Yes, id_order is set to AUTO_INCEMENT.

post-561877-0-95955600-1368187688_thumb.png

 

im going to check this on 1.5.3.1

I'll be very gratefull.

Share this post


Link to post
Share on other sites

the same as before, now i created order with id = 6 - then removed it

after all created another order:

UU5L7MY.png

 

q8kMXVU.png

 

eFTbFIp.png

 

 

really weird. I think that the problem is somewhere else - not in the module

as i said before AUTO_INCREMENT fields always generate unique value, even after remove some fields... So it is really really weird :/

Share this post


Link to post
Share on other sites

Brilliant. Needed to delete the initial order that cannot be removed otherwise in Prestashop. THIS IS THE MODULE YOU NEED TO ACTUALLY GET A CLEAN INSTALL. I understand why the prestashop can't include it to begin with, so thank you for doing this.

 

HERO = VEKIA

Share this post


Link to post
Share on other sites

You're welcome B) if you've got any suggestions - feel free to write

Share this post


Link to post
Share on other sites

Thanks for the module Vekia, it works great!

I have a suggestion: it would be nice for user using the Google Analytics module that when an order is deleted, a reverse ecommerce transaction were reported to analytics (this ways no non existing orders are affecting analytics stats).

 

More info on https://support.google.com/analytics/answer/1037443?hl=en

Share this post


Link to post
Share on other sites

Hello

Thanks for this module Vekia

However, it does not seem to delete invoices corresponding to the deleted order

Edited by markjl (see edit history)

Share this post


Link to post
Share on other sites

thanks markjl for attention. i checked it and i can't reproduce the issue, can you describe it how to reproduce issue? i want to fix it if there is any problem with this

  • Like 1

Share this post


Link to post
Share on other sites

Maybe its me but I was setting a next invoice number

 

and I couldn't set the next invoice number to the invoice number created from the last deleted order.

Edited by markjl (see edit history)

Share this post


Link to post
Share on other sites

Under the orders menu sats delete order.

 

Cheers

Under the orders menu says delete order.

 

Cheers

Share this post


Link to post
Share on other sites

Hi Vekia,

 

just to let you know that I've been checking AdminOrdersController and I've found this

$this->reinjectQuantity($order_detail, $order_detail->product_quantity);

So I've checked your file and didn't find a similar method.

Trying your module confirmed that. ;)

Share this post


Link to post
Share on other sites

hello

 

this module works a bit different, you can check full description with screenshots on module website.

 

while you removing order with "standard" button, it doesn't remove all fields, this is why i used different method

Share this post


Link to post
Share on other sites

Right.

I'd like to know whether the PRO version also reinject item quantity on a non previously "canceled" order or not, please.

Share this post


Link to post
Share on other sites

Thanks for sharing - exactly what I needed. I wanted to remove the sample order (we don't sell computers :P) and some test orders I made to have a clean start.

 

I adjusted the German translation a bit (I am German), do you want it?

Share this post


Link to post
Share on other sites

Thanks for sharing - exactly what I needed. I wanted to remove the sample order (we don't sell computers :P) and some test orders I made to have a clean start.

 

I adjusted the German translation a bit (I am German), do you want it?

 

of course ;) i will be gratefull

 

thanks in advance

support [at] mypresta [dot] eu

Share this post


Link to post
Share on other sites

On my Presta 1.5.6.0 I get this error:

 

Notice: Undefined variable: id_tab in /hosting/www/svizne.cz/erotika.preposilani/modules/deleteordersfree/deleteordersfree.php on line 26 Warning: Cannot modify header information - headers already sent by (output started at /hosting/www/svizne.cz/erotika.preposilani/modules/deleteordersfree/deleteordersfree.php:26) in /hosting/www/svizne.cz/erotika.preposilani/classes/Tools.php on line 141

 

Can You give me an advice?

Edited by puspo (see edit history)

Share this post


Link to post
Share on other sites

On my Presta 1.5.6.0 I get this error:

 

Notice: Undefined variable: id_tab in /hosting/www/svizne.cz/erotika.preposilani/modules/deleteordersfree/deleteordersfree.php on line 26 Warning: Cannot modify header information - headers already sent by (output started at /hosting/www/svizne.cz/erotika.preposilani/modules/deleteordersfree/deleteordersfree.php:26) in /hosting/www/svizne.cz/erotika.preposilani/classes/Tools.php on line 141

 

Can You give me an advice?

 

hello

 

before upload you opened deleteordersfee.php file in simple text editor? (or other text edtiors?)

Share this post


Link to post
Share on other sites

Hello Vekia and thank you for another great module :)

 

I just did a test and deleted an order, PS 1.5.4.1, I checked this database tables to see if there is still traces of the order ( I am not sure I there is more tables to check ) :

 

ps_cart
ps_cart_product
ps_loyalty
ps_loyalty_history
ps_message
ps_orders
ps_order_carrier
ps_order_detail
ps_order_history
ps_order_invoice
ps_order_invoice_payment
ps_order_payment
ps_prestafraud_orders

 

After order deletion with your module, I can still find the order traces in this tables :

 

ps_cart
ps_loyalty
ps_loyalty_history
ps_message
ps_order_carrier
ps_order_invoice
ps_order_invoice_payment
ps_order_payment
ps_prestafraud_orders

 

Can you take a look and eventually adapt the module to have a totally clean order deletion ?

Edited by KevinNash (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Nice module but for v 1.5.6.2 I would add:

//delete customer messages and seller replies regarding to an order
$q= 'DELETE a,b FROM '._DB_PREFIX_.'customer_thread AS a 
       LEFT JOIN '._DB_PREFIX_.'customer_message AS b 
       ON a.id_customer_thread = b.id_customer_thread 
       WHERE id_order="'.$id.'"';			
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

//delete payments
$q= 'DELETE a,b,c FROM '._DB_PREFIX_.'order_invoice_payment AS a 
       LEFT JOIN '._DB_PREFIX_.'order_payment AS b 
       ON a.id_order_payment = b.id_order_payment 
       LEFT JOIN '._DB_PREFIX_.'order_invoice_tax AS c 
       ON a.id_order_invoice = c.id_order_invoice 
       WHERE id_order="'.$id.'"';			
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

//delete invoices
$q = 'DELETE FROM '._DB_PREFIX_.'order_invoice WHERE id_order="'.$id.'"';
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

//delete carriers
$q = 'DELETE FROM '._DB_PREFIX_.'order_carrier WHERE id_order="'.$id.'"';
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

//delete messages
$q= 'DELETE a,b FROM '._DB_PREFIX_.'message AS a 
       LEFT JOIN '._DB_PREFIX_.'message_readed AS b 
       ON a.id_message = b.id_message 
       WHERE id_order="'.$id.'"';
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

//delete order cart rules (not shure what are order cart rules)
$q = 'DELETE FROM '._DB_PREFIX_.'order_cart_rule WHERE id_order="'.$id.'"';
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

I would also changed this:

$q = 'DELETE FROM '._DB_PREFIX_.'order_detail WHERE id_order="'.$id.'"';
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

to this:

$q= 'DELETE a,b FROM '._DB_PREFIX_.'order_detail AS a 
            LEFT JOIN '._DB_PREFIX_.'order_detail_tax AS b 
            ON a.id_order_detail = b.id_order_detail 
            WHERE id_order="'.$id.'"';			
if(!Db::getInstance()->Execute($q)){$this->errorlog[] = $this->l("ERROR");}

I'm not sure if anything else

Share this post


Link to post
Share on other sites

On my Presta 1.5.6.0 I get this error:

 

Notice: Undefined variable: id_tab in /hosting/www/svizne.cz/erotika.preposilani/modules/deleteordersfree/deleteordersfree.php on line 26 Warning: Cannot modify header information - headers already sent by (output started at /hosting/www/svizne.cz/erotika.preposilani/modules/deleteordersfree/deleteordersfree.php:26) in /hosting/www/svizne.cz/erotika.preposilani/classes/Tools.php on line 141

 

Can You give me an advice?

 

I got same error with you.

 

Have you fixed it?

Share this post


Link to post
Share on other sites

I had some wrong/weird orders after deleting old orders in my shop, so I created this query to clean my DB:

DELETE FROM ps_order_carrier         		WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_cart_rule       	WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_detail          		WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_history         	WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_invoice         	WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_invoice_payment 	WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_return         		WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_slip   		WHERE id_order NOT IN (SELECT id_order FROM ps_orders);
DELETE FROM ps_order_detail_tax 		WHERE id_order_detail  NOT IN (SELECT id_order_detail  FROM ps_order_detail);
DELETE FROM ps_order_invoice_payment 	WHERE id_order_invoice NOT IN (SELECT id_order_invoice FROM ps_order_invoice);
DELETE FROM ps_order_invoice_tax 		WHERE id_order_invoice NOT IN (SELECT id_order_invoice FROM ps_order_invoice);

  • Like 1

Share this post


Link to post
Share on other sites

I got same error with you.

 

Have you fixed it?

 

Hi, same problem, somebody has fixed? Thanks

Share this post


Link to post
Share on other sites

Anyone tried modding this to work with .csv files? So we could delete multiple orders by id at once.

Share this post


Link to post
Share on other sites

Attached is a bastardization of Vekia's module + Nemo's Order delete module + my CSV upload code + omaral's suggestions + Pronux's cleanup.

 

It's my usual quick and dirty quality so please improve it, if you like. Error reporting could use work! I just left it in a sorry state.

 

I only made it support PS 1.5+

 

Somehow it seems crazy to use a CSV file when it only has one column, but I had that code ready.. On the other hand, maybe it's easy to grab those order ID's from a spreadsheet you are working on.

 

orderdeletewithcsv.zip

Edited by Beluga (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Attached is a bastardization of Vekia's module + Nemo's Order delete module + my CSV upload code + omaral's suggestions + Pronux's cleanup.

 

It's my usual quick and dirty quality so please improve it, if you like.

 

Somehow it seems crazy to use a CSV file when it only has one column, but I had that code ready.. On the other hand, maybe it's easy to grab those order ID's from a spreadsheet you are working on.

 

Can you add my cleanup too ?

 

ps_cart

ps_loyalty

ps_loyalty_history

ps_message

ps_order_carrier

ps_order_invoice

ps_order_invoice_payment

ps_order_payment

ps_prestafraud_orders

Share this post


Link to post
Share on other sites

Can you add my cleanup too ?

 

ps_cart

ps_loyalty

ps_loyalty_history

ps_message

ps_order_carrier

ps_order_invoice

ps_order_invoice_payment

ps_order_payment

ps_prestafraud_orders

After omaral's modifications, the only ones needing to be added are

_cart

_loyalty

_loyalty_history

 

Prestafraud seems to be some 3rd party module.

Share this post


Link to post
Share on other sites

Hello Vekia and thank you for another great module :)

 

I just did a test and deleted an order, PS 1.5.4.1, I checked this database tables to see if there is still traces of the order ( I am not sure I there is more tables to check ) :

 

ps_cart

ps_cart_product

ps_loyalty

ps_loyalty_history

ps_message

ps_orders

ps_order_carrier

ps_order_detail

ps_order_history

ps_order_invoice

ps_order_invoice_payment

ps_order_payment

ps_prestafraud_orders

 

After order deletion with your module, I can still find the order traces in this tables :

 

ps_cart

ps_loyalty

ps_loyalty_history

ps_message

ps_order_carrier

ps_order_invoice

ps_order_invoice_payment

ps_order_payment

ps_prestafraud_orders

 

Can you take a look and eventually adapt the module to have a totally clean order deletion ?

 

Hello Vekia,

 

Thank you for the update :)

 

Did you add some cleanup in this new version ?

Edited by KevinNash (see edit history)

Share this post


Link to post
Share on other sites

It's not useful if IDs are not restored. 
If I deleter order with ID 99 I assume that next order should also be 99 and not 100. In your accounting you have to have invoices always incremented by 1, without skipping numbers. 

Share this post


Link to post
Share on other sites

Thats not possible RockyS, imagine you have 100 orders and just delete order number 90 ?

 

What should orders 91 to 100 become ? They must stay with the same numbers because it is your customers original orders numbers ;)

 

Your idea should be fine only if you delete the last order ;)

Share this post


Link to post
Share on other sites

Another useful module, thanks for sharing :)

Fine on PS 1.5.6.2

Share this post


Link to post
Share on other sites

i have delete my theme module how can install the theme  module again

 

This module delete orders, not the theme ;)

Share this post


Link to post
Share on other sites

not work in prestashop 1.6.0.6 

ok now, the version 1.3 is ok on prestashop 1.6.0.6

Share this post


Link to post
Share on other sites

Hello,

 

the products from deleted order (by module v1.3) don`t going back to stock?

Besides, I found that products from canceled order (not deleted) don`t going back to stock too. Is it same at anybody? Is it PrestaShop bug or I don`t know some settings in stock management? (1.6.0.6)

Share this post


Link to post
Share on other sites