Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
How to delete orders complete? 
 
Dekard
Member
 
Total Posts:  66
Joined:  2008-06-03
 

bump, can we get this into 1.1, please!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

In the attempt to keep Magento Commerce healthy, we need answers from the Varien team as to if and when this issue will be resolved. Store owners are not going to have the knowledge to go into a database and delete orders, nor would we want them to.

I belive magento team is very busy, and we can say they work well !! but I totaly agree with you, with quick anwsers from team member we can develop faster and sometime it’s for developing for the community.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brandondrew
Member
 
Avatar
Total Posts:  60
Joined:  2007-09-12
 

@Varien (and @Moshe, specifically): The ability to delete test orders CLEANLY is very important.  It would be appreciated if someone from Varien could give us some guidance: should we use iceburn004’s method?  When can we expect this to be easily done from the Admin UI?  Is there some other approach we should take?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

iceburn004’s method works but it’s doesn’t reset the increment_id of order. There is no way to say to Moshe or varien member “Hey come see this topic please ! smile”. Maybe someone who is pro member can ask varien for help on the pro member forom… please.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
josh_trivera
Member
 
Avatar
Total Posts:  62
Joined:  2008-02-12
Wisconsin, USA
 

I agree that having a way to reset the test cart after development is needed!
Having some “reset” options that first provide a backup would be nice.
This would allow one to:

A) auto-backup the settings about to be deleted
B) remove the information not wanted..
1) Remove Products
2) Remove Customers
3) Remove Purchases
5) Reset System (minus configurations)
6) Total Reset cart (and configs)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Q Lam
Jr. Member
 
Total Posts:  2
Joined:  2008-05-05
 

Coming from an SAP world, the inability to delete does have some merit but there should be a status that removes the sales count from the reports i.e. sales, inventory, etc.

My inventory count and sales count are all wonky right now and it is proving to be a pain in the neck.

 
Magento Community Magento Community
Magento Community
Magento Community
 
karynn
Member
 
Avatar
Total Posts:  69
Joined:  2008-02-07
 

Just want to add my THANK YOU!

This script worked for me (1.0.19870.4)

 
Magento Community Magento Community
Magento Community
Magento Community
 
iceburn004
Jr. Member
 
Total Posts:  6
Joined:  2008-05-18
Sydney
 

Thank you for your kind feedback, I’ve been busy lately with other projects. I do hope someone from Varien can confirm that the SQL commands are okay, and don’t delete anything that it shouldn’t.

I’ll have a look into resetting the counters when i get the chance, but the first time I was poking around, i couldn’t figure out where exactly it was located. It wasn’t in the obvious locations.

I’ll keep you posted if i figure it out…

Regards
David N

 
Magento Community Magento Community
Magento Community
Magento Community
 
ArthurDent
Member
 
Total Posts:  37
Joined:  2008-05-06
 

Hi!

I just want to commit the SQL-statement that helped me out.

set @increment_id='100000001';
select @order_id:=entity_id from sales_order_entity where increment_id=@increment_id;
delete from sales_order_entity where entity_id=@order_id or parent_id=@order_id
delete from sales_order where increment_id=@increment_id;

You can just define the order’s increment_id in the first line. The following three SQL-statements will delete the records in sales_order_entity and sales_order tables.

Kind regards!

 
Magento Community Magento Community
Magento Community
Magento Community
 
ralphie
Member
 
Total Posts:  47
Joined:  2007-12-20
London
 

hi guys

the location where the increment_id sequence is stored seems to be in the eav_entity_store table

cheers,

ralph

 
Magento Community Magento Community
Magento Community
Magento Community
 
iceburn004
Jr. Member
 
Total Posts:  6
Joined:  2008-05-18
Sydney
 

Hi Ralphie, i just figured that as well.

I just tested it on a my DB and its working so far,
it will reset it to 1......1 not sure how many zero’s there are in there, you get the drift.

TRUNCATE `sales_order`;
TRUNCATE `sales_order_datetime`;
TRUNCATE `sales_order_decimal`;
TRUNCATE `sales_order_entity`;
TRUNCATE `sales_order_entity_datetime`;
TRUNCATE `sales_order_entity_decimal`;
TRUNCATE `sales_order_entity_int`;
TRUNCATE `sales_order_entity_text`;
TRUNCATE `sales_order_entity_varchar`;
TRUNCATE `sales_order_int`;
TRUNCATE `sales_order_text`;
TRUNCATE `sales_order_varchar`;
TRUNCATE `sales_quote`;
TRUNCATE `sales_quote_address`;
TRUNCATE `sales_quote_address_decimal`;
TRUNCATE `sales_quote_address_int`;
TRUNCATE `sales_quote_address_text`;
TRUNCATE `sales_quote_address_varchar`;
TRUNCATE `sales_quote_decimal`;
TRUNCATE `sales_quote_entity`;
TRUNCATE `sales_quote_entity_datetime`;
TRUNCATE `sales_quote_entity_decimal`;
TRUNCATE `sales_quote_entity_int`;
TRUNCATE `sales_quote_entity_text`;
TRUNCATE `sales_quote_entity_varchar`;
TRUNCATE `sales_quote_int`;
TRUNCATE `sales_quote_item`;
TRUNCATE `sales_quote_item_decimal`;
TRUNCATE `sales_quote_item_int`;
TRUNCATE `sales_quote_item_text`;
TRUNCATE `sales_quote_item_varchar`;
TRUNCATE `sales_quote_rule`;
TRUNCATE `sales_quote_text`;
TRUNCATE `sales_quote_varchar`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;



ALTER TABLE `sales_orderAUTO_INCREMENT=1;
ALTER TABLE `sales_order_datetimeAUTO_INCREMENT=1;
ALTER TABLE `sales_order_decimalAUTO_INCREMENT=1;
ALTER TABLE `sales_order_entityAUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_datetimeAUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_decimalAUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_intAUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_textAUTO_INCREMENT=1;
ALTER TABLE `sales_order_entity_varcharAUTO_INCREMENT=1;
ALTER TABLE `sales_order_intAUTO_INCREMENT=1;
ALTER TABLE `sales_order_textAUTO_INCREMENT=1;
ALTER TABLE `sales_order_varcharAUTO_INCREMENT=1;
ALTER TABLE `sales_quoteAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_addressAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_address_decimalAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_address_intAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_address_textAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_address_varcharAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_decimalAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_entityAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_entity_datetimeAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_entity_decimalAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_entity_intAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_entity_textAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_entity_varcharAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_intAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_itemAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_item_decimalAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_item_intAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_item_textAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_item_varcharAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_ruleAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_textAUTO_INCREMENT=1;
ALTER TABLE `sales_quote_varcharAUTO_INCREMENT=1;
ALTER TABLE `sendfriend_logAUTO_INCREMENT=1;
ALTER TABLE `tagAUTO_INCREMENT=1;
ALTER TABLE `tag_relationAUTO_INCREMENT=1;
ALTER TABLE `tag_summaryAUTO_INCREMENT=1;
ALTER TABLE `wishlistAUTO_INCREMENT=1;
ALTER TABLE `log_quoteAUTO_INCREMENT=1;
ALTER TABLE `report_eventAUTO_INCREMENT=1;


-- 
reset customers
TRUNCATE 
`customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
TRUNCATE `customer_entity_datetime`;
TRUNCATE `customer_entity_decimal`;
TRUNCATE `customer_entity_int`;
TRUNCATE `customer_entity_text`;
TRUNCATE `customer_entity_varchar`;
TRUNCATE `log_customer`;
TRUNCATE `log_visitor`;
TRUNCATE `log_visitor_info`;


ALTER TABLE `customer_address_entityAUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_datetimeAUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_decimalAUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_intAUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_textAUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity_varcharAUTO_INCREMENT=1;
ALTER TABLE `customer_entityAUTO_INCREMENT=1;
ALTER TABLE `customer_entity_datetimeAUTO_INCREMENT=1;
ALTER TABLE `customer_entity_decimalAUTO_INCREMENT=1;
ALTER TABLE `customer_entity_intAUTO_INCREMENT=1;
ALTER TABLE `customer_entity_textAUTO_INCREMENT=1;
ALTER TABLE `customer_entity_varcharAUTO_INCREMENT=1;
ALTER TABLE `log_customerAUTO_INCREMENT=1;
ALTER TABLE `log_visitorAUTO_INCREMENT=1;
ALTER TABLE `log_visitor_infoAUTO_INCREMENT=1;


-- 
Reset all ID counters
TRUNCATE 
`eav_entity_store`;
ALTER TABLE  `eav_entity_storeAUTO_INCREMENT=1;

Hope that helps everyone.

Cheers.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nicolas46
Sr. Member
 
Total Posts:  210
Joined:  2008-04-09
Toulouse
 

Thanks a lot for your contribution iceburn004.

 
Magento Community Magento Community
Magento Community
Magento Community
 
traviswu
Member
 
Total Posts:  31
Joined:  2008-05-29
 

Hi, I used ArthurDent’s code to remove orders which worked out ok.  Except that the related “credit memos” / refunds were not removed. I still see the orphaned entries under “sales” -> “credit memos”
any ideas?  I couldn’t find it anywhere in the database.

 
Magento Community Magento Community
Magento Community
Magento Community
 
traviswu
Member
 
Total Posts:  31
Joined:  2008-05-29
 

Ok, I found the answer myself.
here is how I removed the orphaned “credit memos”. turned out that the memo number is just like another order number .
so
1) get the memo number and the time stamp (created on)
2) search in magento sales_order_entity db for the order number
3) most likely you’ll see two return results, 1 being a new order (since the system reuses the order number), the other being the orphaned memo number; identify the memo entry by matching the time stamp. (for me the timezone was messed up but mins and secs match)
4) remove the entry.
: )

 
Magento Community Magento Community
Magento Community
Magento Community
 
leeaston
Member
 
Total Posts:  59
Joined:  2007-11-26
France
 

Hello, anyone tested the iceburn004 code in 1.1.1?

Best wishes
Lee

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53227 users|851 users currently online|107289 forum posts