Zurücksetzen aller Bestellungen im Magento-Shop

Nach der Testphase kann es erforderlich sein, bisher ausgelöste Testbestellungen zu löschen. Das ist mit folgenden SQL-Queries möglich:
SET FOREIGN_KEY_CHECKS=0;
-- reset dashboard search queries
TRUNCATE `magecatalogsearch_query`;
-- reset sales order info
TRUNCATE `magesales_flat_creditmemo`;
TRUNCATE `magesales_flat_creditmemo_comment`;
TRUNCATE `magesales_flat_creditmemo_grid`;
TRUNCATE `magesales_flat_creditmemo_item`;
TRUNCATE `magesales_flat_invoice`;
TRUNCATE `magesales_flat_invoice_comment`;
TRUNCATE `magesales_flat_invoice_grid`;
TRUNCATE `magesales_flat_invoice_item`;
TRUNCATE `magesales_flat_order`;
TRUNCATE `magesales_flat_order_address`;
TRUNCATE `magesales_flat_order_grid`;
TRUNCATE `magesales_flat_order_item`;
TRUNCATE `magesales_flat_order_payment`;
TRUNCATE `magesales_flat_order_status_history`;
TRUNCATE `magesales_flat_quote`;
TRUNCATE `magesales_flat_quote_address`;
TRUNCATE `magesales_flat_quote_address_item`;
TRUNCATE `magesales_flat_quote_item`;
TRUNCATE `magesales_flat_quote_item_option`;
TRUNCATE `magesales_flat_quote_payment`;
TRUNCATE `magesales_flat_quote_shipping_rate`;
TRUNCATE `magesales_flat_shipment`;
TRUNCATE `magesales_flat_shipment_comment`;
TRUNCATE `magesales_flat_shipment_grid`;
TRUNCATE `magesales_flat_shipment_item`;
TRUNCATE `magesales_flat_shipment_track`;
TRUNCATE `magesales_invoiced_aggregated`;
TRUNCATE `magesales_invoiced_aggregated_order`;
TRUNCATE `magesales_order_aggregated_created`;
TRUNCATE `magesendfriend_log`;
TRUNCATE `magetag`;
TRUNCATE `magetag_relation`;
TRUNCATE `magetag_summary`;
TRUNCATE `magewishlist`;
TRUNCATE `magelog_quote`;
TRUNCATE `magereport_event`;
TRUNCATE `magesales_order_tax`;
TRUNCATE `magesales_order_tax_item`;
TRUNCATE `magedownloadable_link_purchased`;
TRUNCATE `magedownloadable_link_purchased_item`;
SET FOREIGN_KEY_CHECKS=1;

Dadurch werden alle Bestellungen und sonstige Einträge gelöscht. Um zusätzlich auch noch die Bestellnummern etc. zurückzusetzen, können folgende Befehle ebenfalls ausgeführt werden:
ALTER TABLE `magecatalogsearch_query` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice_comment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_status_history` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment_comment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment_track` AUTO_INCREMENT=1;
ALTER TABLE `magesales_invoiced_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `magesales_invoiced_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `magesales_order_aggregated_created` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `magetag` AUTO_INCREMENT=1;
ALTER TABLE `magetag_relation` AUTO_INCREMENT=1;
ALTER TABLE `magetag_summary` AUTO_INCREMENT=1;
ALTER TABLE `magewishlist` AUTO_INCREMENT=1;
ALTER TABLE `magelog_quote` AUTO_INCREMENT=1;
ALTER TABLE `magereport_event` AUTO_INCREMENT=1;
ALTER TABLE `magesales_order_tax` AUTO_INCREMENT=1;
ALTER TABLE `magesales_order_tax_item` AUTO_INCREMENT=1;
ALTER TABLE `magedownloadable_link_purchased` AUTO INCREMENT=1;
ALTER TABLE `magedownloadable_link_purchased_item` AUTO INCREMENT=1;

Vorsichtshalber sollte natürlich trotzdem vorher ein Backup erstellt werden.

Leave A Comment?

You must be logged in to post a comment.