Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Eliminare ordini spedizioni fatture e note di credito di prova
 
TreInnova
Guru
 
Avatar
Total Posts:  465
Joined:  2009-02-20
Fano
 

Ciao a tutta la lista vorrei condividere uno script che ho utilizzato per eliminare ordini,spedizioni,fatture e note di credito di prova e per riportare le numerazioni allo stato iniziale. Vorrei avere un giudizio sulla validità dello script e se secondo voi ci sono delle controindicazioni.

SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `catalogsearch_query`;
ALTER TABLE `catalogsearch_queryAUTO_INCREMENT=1;

-- 
reset sales order info
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_order_item`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;

ALTER TABLE `sales_flat_orderAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_addressAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_gridAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_itemAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_paymentAUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_status_historyAUTO_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;
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 all ID counters
TRUNCATE 
`eav_entity_store`;
ALTER TABLE `eav_entity_storeAUTO_INCREMENT=1;

-- 
set appropriate prefixes for ordersinvoicesshipmentscredit memos
INSERT INTO 
`eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES ('1''11''1''1''000000000');
update `eav_entity_storeset `increment_prefix`= 1 where `entity_type_id`='5' and `store_id`='1';
update `eav_entity_storeset `increment_last_id`= '000000000' where `entity_type_id`='4' and `store_id`='1';

INSERT INTO `eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES ('2''16''1''2''000000000');
update `eav_entity_storeset `increment_prefix`= 2 where `entity_type_id`='6' and `store_id`='1';
update `eav_entity_storeset `increment_last_id`= '000000000' where `entity_type_id`='18' and `store_id`='1';

INSERT INTO `eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES ('3''19''1''3''000000000');
update `eav_entity_storeset `increment_prefix`= 3 where `entity_type_id`='8' and `store_id`='1';
update `eav_entity_storeset `increment_last_id`= '000000000' where `entity_type_id`='24' and `store_id`='1';

INSERT INTO `eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES ('4''23''1''4''000000000');
update `eav_entity_storeset `increment_prefix`= 4 where `entity_type_id`='7' and `store_id`='1';
update `eav_entity_storeset `increment_last_id`= '000000000' where `entity_type_id`='28' and `store_id`='1';

SET FOREIGN_KEY_CHECKS=1;
Grazie a tutti
filippo
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top