I would like to know this as well. Where on that table in the database is the order I’m deleting? I’m surprised there is no option from the admin panel because the store owners may need to delete orders and know nothing about accessing databases.
Moshe - I used your sql script to delete like one or two test orders, but now in the Sales > Orders I see the new order, but when you go to view the order, the new order is all messed up. I looks like it has the wrong billing/shipping info and there are orders on the new order that was from the old order that was supposed to be deleted. The shipping/billing info is from the deleted order as well.
Any ideas on how to fix this? I would appear that I cant send out any emails to this new order because it is showing all the wrong data.
Please help.
Thanks
Hi, please use at your own risk, it works so far, i haven’t found any problems with it yet. it will reset, order,invoices,shipment and customers, most viewed and other stuff.
But it doesn’t reset the orderID, for the life of me i can’t figure out where they get the increment_id from
ALTER TABLE `sales_order` AUTO_INCREMENT=1; ALTER TABLE `sales_order_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_order_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_int` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_text` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_order_int` AUTO_INCREMENT=1; ALTER TABLE `sales_order_text` AUTO_INCREMENT=1; ALTER TABLE `sales_order_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_quote` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_address` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_address_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_address_int` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_address_text` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_address_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_entity` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_entity_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_entity_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_entity_int` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_entity_text` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_entity_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_int` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_item` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_item_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_item_int` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_item_text` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_item_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_rule` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_text` AUTO_INCREMENT=1; ALTER TABLE `sales_quote_varchar` AUTO_INCREMENT=1; ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1; ALTER TABLE `tag` AUTO_INCREMENT=1; ALTER TABLE `tag_relation` AUTO_INCREMENT=1; ALTER TABLE `tag_summary` AUTO_INCREMENT=1; ALTER TABLE `wishlist` AUTO_INCREMENT=1; ALTER TABLE `log_quote` AUTO_INCREMENT=1; ALTER TABLE `report_event` AUTO_INCREMENT=1;
ALTER TABLE `customer_address_entity` AUTO_INCREMENT=1; ALTER TABLE `customer_address_entity_datetime` AUTO_INCREMENT=1; ALTER TABLE `customer_address_entity_decimal` AUTO_INCREMENT=1; ALTER TABLE `customer_address_entity_int` AUTO_INCREMENT=1; ALTER TABLE `customer_address_entity_text` AUTO_INCREMENT=1; ALTER TABLE `customer_address_entity_varchar` AUTO_INCREMENT=1; ALTER TABLE `customer_entity` AUTO_INCREMENT=1; ALTER TABLE `customer_entity_datetime` AUTO_INCREMENT=1; ALTER TABLE `customer_entity_decimal` AUTO_INCREMENT=1; ALTER TABLE `customer_entity_int` AUTO_INCREMENT=1; ALTER TABLE `customer_entity_text` AUTO_INCREMENT=1; ALTER TABLE `customer_entity_varchar` AUTO_INCREMENT=1; ALTER TABLE `log_customer` AUTO_INCREMENT=1; ALTER TABLE `log_visitor` AUTO_INCREMENT=1; ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1;
Great job iceburn004 !
Can somebody of Varien staff can validate this work and maybe give us more information about a future feature which solve this problem ?
This worked for me too and solved two more strange problems I had with my orders.
Maybe someone else experienced this too, so FYI:
After deleting orders one by one (as described earlier in this thread) I got stuck with two errors:
- Shipping and Billing Addresses were the same for each client! (they were somehow copied from the first order)
- I had a “ghost” item that was added to each order. It was a test product that had been ordered by another testuser before, but that order was canceled. The ghostproduct showed up in every following order as a cancelled order.
I’m not sure if deleting the items one by one caused the errors, but iceburn004’s method works great.
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.