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? 
 
R.Verheij
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2008-04-08
Amsterdam, Netherlands
 

Hi, I just got the most recent code from above and used it on a 1.1.1 database.
Many tables do not exist any more, so I deleted old tables from the script, and will post the script here, but notice that I did not check if any new tables in 1.1.1 should also be truncated

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_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
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_flat_quoteAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_addressAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_itemAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_itemAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_optionAUTO_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;

 
Magento Community Magento Community
Magento Community
Magento Community
 
roshangmail
Jr. Member
 
Avatar
Total Posts:  28
Joined:  2008-05-18
 

i m confused

in this query which one is the right one to delete the order listing in admin pannel

1 select @order_id:=entity_id from sales_order_entity where increment_id=’100000001’;
delete from sales_order_entity where entity_id=@order_id or parent_id=@order_id;

2 select @order_id:=entity_id from sales_order where increment_id=’100000001’;
delete from sales_order where entity_id=@order_id or parent_id=@order_id;

which one is correct???

Magento ver. 1.0.19870

 Signature 

Want to be a good programer But eva succed!!! :s

 
Magento Community Magento Community
Magento Community
Magento Community
 
I'm Done
Member
 
Total Posts:  32
Joined:  2008-05-08
 
leeaston - 30 July 2008 12:56 AM

Hello, anyone tested the iceburn004 code in 1.1.1?

Best wishes
Lee

Are you saying this option of deleting orders is not available in 1.1.1 yet?!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sensi
Member
 
Total Posts:  69
Joined:  2008-07-31
Paris, France
 

Hi to everybody!

R.Verheij - 30 July 2008 05:46 AM

Hi, I just got the most recent code from above and used it on a 1.1.1 database.
Many tables do not exist any more, so I deleted old tables from the script, and will post the script here, but notice that I did not check if any new tables in 1.1.1 should also be truncated

Thank you R.Verheij, I just had to add the “sales_flat_order_item” table and it looks like that did the trick. smile

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_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_item`; # added
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_flat_quoteAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_addressAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_itemAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_itemAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_optionAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_itemAUTO_INCREMENT=1# added
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;

 Signature 

Friends: Kaipifraise web agency

 
Magento Community Magento Community
Magento Community
Magento Community
 
ALEON™
Jr. Member
 
Total Posts:  10
Joined:  2008-06-09
 

Hi folks

So that means I can run this query and it removes all orders without ghost-entries or death-entries?

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
infield
Member
 
Total Posts:  67
Joined:  2007-11-04
San Francisco
 

Anyone know how to make the starting order something besides 10000000? We would like to make it 200000000.

 
Magento Community Magento Community
Magento Community
Magento Community
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

Why are the magento team so quite?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gamelodge
Sr. Member
 
Avatar
Total Posts:  89
Joined:  2007-08-31
Brisbane, Qld, Australia
 

@R.Verheij & Sensi - v1.1.2
SQL query:

TRUNCATE `sales_flat_quote` ;

MySQL said: Documentation
#1217 - Cannot delete or update a parent row: a foreign key constraint fails

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michael
Magento Team
 
Total Posts:  684
Joined:  2007-08-31
 
infield - 04 August 2008 07:45 AM

Anyone know how to make the starting order something besides 10000000? We would like to make it 200000000.

Check the eav_entity_store table

 
Magento Community Magento Community
Magento Community
Magento Community
 
ALEON™
Jr. Member
 
Total Posts:  10
Joined:  2008-06-09
 

Maybe someone is interested. I’ve tested the query (without the reset customers values) on a 1.1.2 version. Do it for you own risk, but it worked all well for me!
Regards
Sandro

 
Magento Community Magento Community
Magento Community
Magento Community
 
medlington
Member
 
Total Posts:  69
Joined:  2008-04-30
 

So will this script delete all orders or can I get it to delete only certain ones?

I may have to send test orders through again in the future and it would be a real pain if I had to delete all of the stored orders each time.

 Signature 

the worlds most portable football goals - 3d animation sheffield - Product design and prototype development - Kenya tourist information - Fable Films - Video Production Sheffield

 
Magento Community Magento Community
Magento Community
Magento Community
 
J.T.
Sr. Member
 
Total Posts:  218
Joined:  2008-08-07
 

Sounds like most of you are testing on your production shop. It’s bad practice and you will live to regret that one day.

Always have two installations. Do you development on the second one, whilst the first one is live. Once you are absolutely happy you finished a certain improvement, you copy that over to the production shop, but only after you took a full back-up of the files and database of the production installation.

See programs like Beyond Compare etc. to do all of this easily.

If you had been testing on your dev install you wouldn;t have this delete issue.

 Signature 

Go 1.1.7!

 
Magento Community Magento Community
Magento Community
Magento Community
 
medlington
Member
 
Total Posts:  69
Joined:  2008-04-30
 

but what about when a customer is directed to paypal and then doesnt complete the order either through choice or a crash. They then might remake the order but there is still the pending order in the list that is reduntant and should be deleted.

Also my client has a habbit of sending orders through himslef just to make sure its working and these need to be deleted too.

 Signature 

the worlds most portable football goals - 3d animation sheffield - Product design and prototype development - Kenya tourist information - Fable Films - Video Production Sheffield

 
Magento Community Magento Community
Magento Community
Magento Community
 
tartan
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2008-05-09
 
medlington - 11 August 2008 12:23 AM

but what about when a customer is directed to paypal and then doesnt complete the order either through choice or a crash. They then might remake the order but there is still the pending order in the list that is reduntant and should be deleted.

Also my client has a habbit of sending orders through himslef just to make sure its working and these need to be deleted too.

Exactly....

 Signature 

Josh
Denver, CO

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sensi
Member
 
Total Posts:  69
Joined:  2008-07-31
Paris, France
 
gamelodge - 05 August 2008 04:28 PM

@R.Verheij & Sensi - v1.1.2
SQL query:

TRUNCATE `sales_flat_quote` ;

MySQL said: Documentation
#1217 - Cannot delete or update a parent row: a foreign key constraint fails

Yeah, like mentioned it was meant for 1.1.1, will have to check which changes were introduced by 1.1.2.

 Signature 

Friends: Kaipifraise web agency

 
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)