Ето работает
[$connection = Mage::getSingleton('core/resource')->getConnection('core_write'); $connection->beginTransaction(); $delete = $connection->query(' SET FOREIGN_KEY_CHECKS=0; ALTER TABLE `catalogsearch_query` AUTO_INCREMENT=1; DELETE FROM sales_flat_order; DELETE FROM sales_flat_order_address; DELETE FROM sales_flat_order_grid; DELETE FROM sales_flat_order_item; DELETE FROM sales_flat_order_payment; DELETE FROM sales_flat_order_status_history; 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; SET FOREIGN_KEY_CHECKS=1;
Ето нет
$connection = Mage::getSingleton('core/resource')->getConnection('core_write'); $connection->beginTransaction(); $delete = $connection->query(' SET FOREIGN_KEY_CHECKS=0; ALTER TABLE `catalogsearch_query` AUTO_INCREMENT=1; DELETE FROM sales_flat_order WHERE entity_id=20; DELETE FROM sales_flat_order_address WHERE parent_id=20; DELETE FROM sales_flat_order_grid WHERE entity_id=20; DELETE FROM sales_flat_order_item WHERE order_id=20; DELETE FROM sales_flat_order_payment WHERE entity_id=20; DELETE FROM sales_flat_order_status_history WHERE parent_id=20; 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; SET FOREIGN_KEY_CHECKS=1; ');
Если выполнить этот запрос напрямую в базе все отработает.