Magento – Clear all Test-/Bestellungen in Magento 1.7.0.2

Who a new shop touches, usually also makes Test orders, to see, if it works. If the payment correctly linked, get feedback from PayPal, Credit card etc. correctly back to the shop?

But if we have now tested all, are the Test orders in the system and can be standard also are not deleted. So how to delete the test orders from Magento? Here, however, helps a SQL command, directly e.g.. at phpMyAdmin can be entered, AFTER you have done a full database backup (Here it is safer in addition to Magento fuse to make one export directly from phpMyAdmin!). When it comes to problems, you can then quickly upload this again and New systems, the databases are indeed not so great.

The SQL command is (in the first row “magento_datenbank” replaced by the name of its database):

USE `` magento_datenbank;
SET FOREIGN_KEY_CHECKS=0;
-- reset dashboard search queries
TRUNCATE `catalogsearch_query`;
ALTER TABLE `catalogsearch_query` AUTO_INCREMENT = 1;
-- reset dashboard search queries
TRUNCATE `catalogsearch_query`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_payment`;
TRUNCATE `sales_flat_order_status_history`;
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_quote_payment`;
TRUNCATE `sales_flat_quote_shipping_rate`;
TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_comment`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_track`;
TRUNCATE `sales_invoiced_aggregated`;
TRUNCATE `sales_invoiced_aggregated_order`;
TRUNCATE `sales_order_aggregated_created`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;
ALTER TABLE `sales_flat_creditmemo` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_comment` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_order` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_quote_shipping_rate` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT = 1;
ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_aggregated_created` 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;
SET FOREIGN_KEY_CHECKS=1;

Dieser Befehl löscht dann alle Testbestellungen wie auch Schlagworte, Wunschzettel und was sonst noch beim Testen anfällt. Wichtig ist jedoch zu beachten, dass nach diesem Befehl Magento nicht wieder bei 1 anfängt. War also z.B. die letzte Testbestellung 100000009, dann wurden die Testbestellungen gelöscht, wird die nächste Bestellung dann dennoch 100000010 be.

Möchte man dies nicht und wieder bei 1 start or even have a different number, you should this Fill watch once.

Contributing to an extension, can delete directly from the backend orders, there HERE

Used in Magento Version 1.7.0.2. Comments, Questions like! Just contact or leave a comment.

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

5 comments on “Magento – Clear all Test-/Bestellungen in Magento 1.7.0.2”

  1. It must also include the table “sales_order_tax” be emptied, be otherwise spent several times for new orders and invoices Taxes.
    => Magento 1.9.2.4

  2. the table “sales_order_tax_item” must be emptied otherwise the customer gets an error message when the first new order and can only after again press the checkout button to trigger the order or. the store owner in my case also gets an email about a failed payment. Version M 1.9.4.1

Leave a Reply

Your email address will not be published. Required fields are marked *