Si vous avez besoin de remettre à zéro toutes les commandes passées en test sur votre serveur de développement avant de passer en serveur de production, vous pouvez exécuter la commande SQL suivante :

Attention, cela supprime aussi les clients de test, les factures et autres. Pensez à faire une sauvegarde avant !!

Magento = 1.7.*.* :

Cette requête supprimera :

  • Les clients
  • Les recherches du moteur de recherche
  • Les commandes
  • Les factures
  • Les expéditions
  • Les avoirs
  • Les rapports de taxes au moment d’une commande
  • Les listes d’envies
  • Les tags des internautes
  • Les logs
SET FOREIGN_KEY_CHECKS=0; 
-- Reset Customers / Customer Address 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; 
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; 
-- Reset Catalog Search TRUNCATE `catalogsearch_query`; 
ALTER TABLE `catalogsearch_query` AUTO_INCREMENT=1; 
-- Reset Sales (Credit Memo / Invoice / Order / Quote / Shipment) TRUNCATE `sales_flat_creditmemo`; 
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 `sales_order_tax` ; 
TRUNCATE `sales_order_tax_item` ; 
TRUNCATE `eav_entity_store` ; 
-- Reset numbers to 100000001 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 `sales_order_tax` AUTO_INCREMENT=1; 
ALTER TABLE `sales_order_tax_item` AUTO_INCREMENT=1; 
ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1; 
-- Reset Admin Panel (Best Sellers) TRUNCATE `sales_bestsellers_aggregated_daily`; 
TRUNCATE `sales_bestsellers_aggregated_monthly`; 
TRUNCATE `sales_bestsellers_aggregated_yearly`; 
ALTER TABLE `sales_bestsellers_aggregated_daily` AUTO_INCREMENT=1; 
ALTER TABLE `sales_bestsellers_aggregated_monthly` AUTO_INCREMENT=1; 
ALTER TABLE `sales_bestsellers_aggregated_yearly` AUTO_INCREMENT=1; 
-- Reset Report index TRUNCATE `report_viewed_product_index`; 
TRUNCATE `report_compared_product_index`; 
ALTER TABLE `report_viewed_product_index` AUTO_INCREMENT=1; 
ALTER TABLE `report_compared_product_index` AUTO_INCREMENT=1; 
-- Reset Tag ALTER TABLE `tag` AUTO_INCREMENT=1; 
ALTER TABLE `tag_relation` AUTO_INCREMENT=1; 
ALTER TABLE `tag_summary` AUTO_INCREMENT=1; 
TRUNCATE `tag`; 
TRUNCATE `tag_relation`; 
TRUNCATE `tag_summary`; 
-- Reset Wishlist TRUNCATE `wishlist`; 
ALTER TABLE `wishlist` AUTO_INCREMENT=1; 
-- Reset log TRUNCATE `log_customer`; 
TRUNCATE `log_quote`; 
TRUNCATE `log_summary`; 
TRUNCATE `log_summary_type`; 
TRUNCATE `log_url`; 
TRUNCATE `log_url_info`; 
TRUNCATE `log_visitor`; 
TRUNCATE `log_visitor_info`; 
TRUNCATE `log_visitor_online`; 
ALTER TABLE `log_customer` AUTO_INCREMENT=1; 
ALTER TABLE `log_quote` AUTO_INCREMENT=1; 
ALTER TABLE `log_summary` AUTO_INCREMENT=1; 
ALTER TABLE `log_summary_type` AUTO_INCREMENT=1; 
ALTER TABLE `log_url` AUTO_INCREMENT=1; 
ALTER TABLE `log_url_info` AUTO_INCREMENT=1; 
ALTER TABLE `log_visitor` AUTO_INCREMENT=1; 
ALTER TABLE `log_visitor_info` AUTO_INCREMENT=1; 
ALTER TABLE `log_visitor_online` AUTO_INCREMENT=1; 
TRUNCATE `sendfriend_log`; 
TRUNCATE `report_event`; 
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1; 
ALTER TABLE `report_event` AUTO_INCREMENT=1; 
-- Reset Poll answer UPDATE poll_answer SET votes_count = 0; 
SET FOREIGN_KEY_CHECKS=1;

Pour la version Enterprise uniquement :

SET FOREIGN_KEY_CHECKS=0; 
-- Enterprise Achives TRUNCATE enterprise_sales_creditmemo_grid_archive; 
TRUNCATE enterprise_sales_invoice_grid_archive; 
TRUNCATE enterprise_sales_order_grid_archive; 
TRUNCATE enterprise_sales_shipment_grid_archive; 
ALTER TABLE enterprise_sales_creditmemo_grid_archive AUTO_INCREMENT=1; 
ALTER TABLE enterprise_sales_invoice_grid_archive AUTO_INCREMENT=1; 
ALTER TABLE enterprise_sales_order_grid_archive AUTO_INCREMENT=1; 
ALTER TABLE enterprise_sales_shipment_grid_archive AUTO_INCREMENT=1; 
SET FOREIGN_KEY_CHECKS=1;

Magento >= 1.4.*.* :

TRUNCATE `customer_address_entity` ; 
ALTER TABLE customer_address_entity AUTO_INCREMENT=0; 
TRUNCATE `customer_address_entity_datetime` ; 
ALTER TABLE customer_address_entity_datetime AUTO_INCREMENT=0; 
TRUNCATE `customer_address_entity_decimal` ; 
ALTER TABLE customer_address_entity_decimal AUTO_INCREMENT=0; 
TRUNCATE `customer_address_entity_int` ; 
ALTER TABLE customer_address_entity_int AUTO_INCREMENT=0; 
TRUNCATE `customer_address_entity_text` ; 
ALTER TABLE customer_address_entity_text AUTO_INCREMENT=0; 
TRUNCATE `customer_address_entity_varchar` ; 
ALTER TABLE customer_address_entity_varchar AUTO_INCREMENT=0; 
TRUNCATE `customer_entity` ; 
ALTER TABLE customer_entity AUTO_INCREMENT=0; 
TRUNCATE `customer_entity_datetime` ; 
ALTER TABLE customer_entity_datetime AUTO_INCREMENT=0; 
TRUNCATE `customer_entity_decimal` ; 
ALTER TABLE customer_entity_decimal AUTO_INCREMENT=0; 
TRUNCATE `customer_entity_int` ; 
ALTER TABLE customer_entity_int AUTO_INCREMENT=0; 
TRUNCATE `customer_entity_text` ; 
ALTER TABLE customer_entity_text AUTO_INCREMENT=0; 
TRUNCATE `customer_entity_varchar` ; 
ALTER TABLE customer_entity_varchar AUTO_INCREMENT=0; 
TRUNCATE `eav_entity_store` ; 
ALTER TABLE eav_entity_store AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_order` ; 
ALTER TABLE sales_flat_order AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_order_address` ; 
ALTER TABLE sales_flat_order_address AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_order_grid` ; 
ALTER TABLE sales_flat_order_grid AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_order_item` ; 
ALTER TABLE sales_flat_order_item AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_order_payment` ; 
ALTER TABLE sales_flat_order_payment AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_order_status_history` ; 
ALTER TABLE sales_flat_order_status_history AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote` ; 
ALTER TABLE sales_flat_quote AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote_address` ; 
ALTER TABLE sales_flat_quote_address AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote_address_item` ; 
ALTER TABLE sales_flat_quote_address_item AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote_item` ; 
ALTER TABLE sales_flat_quote_item AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote_item_option` ; 
ALTER TABLE sales_flat_quote_item_option AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote_payment` ; 
ALTER TABLE sales_flat_quote_payment AUTO_INCREMENT=0; 
TRUNCATE `sales_flat_quote_shipping_rate` ; 
ALTER TABLE sales_flat_quote_shipping_rate AUTO_INCREMENT=0; 
TRUNCATE `sales_order_tax` ; 
ALTER TABLE sales_order_tax AUTO_INCREMENT=0;

Magento < 1.4 :

DELETE FROM sales_flat_order_item; 
DELETE FROM sales_flat_quote; 
DELETE FROM sales_flat_quote_address; 
DELETE FROM sales_flat_quote_address_item; 
DELETE FROM sales_flat_quote_item; 
DELETE FROM sales_flat_quote_item_option; 
DELETE FROM sales_flat_quote_payment; 
DELETE FROM sales_flat_quote_shipping_rate; 
DELETE FROM sales_order; 
DELETE FROM sales_order_datetime; 
DELETE FROM sales_order_decimal; 
DELETE FROM sales_order_entity; 
DELETE FROM sales_order_entity_datetime; 
DELETE FROM sales_order_entity_decimal; 
DELETE FROM sales_order_entity_int; 
DELETE FROM sales_order_entity_text; 
DELETE FROM sales_order_entity_varchar; 
DELETE FROM sales_order_int; 
DELETE FROM sales_order_tax; 
DELETE FROM sales_order_text; 
DELETE FROM sales_order_varchar; 
DELETE FROM eav_entity_store;

Source

Une réponse à “[Magento] Remise à zéro des commandes”