Revision: 41833
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 23, 2011 20:55 by hotdiggity
Initial Code
<?php require_once('app/Mage.php'); Mage::app('admin'); Mage::getSingleton("core/session", array("name" => "adminhtml")); Mage::register('isSecureArea',true); $collection = Mage::getResourceModel('sales/order_collection') ->addAttributeToSelect('*') ->setPageSize(5000) ->addFieldToFilter('status', 'canceled')->load(); foreach ($collection as $col) { Mage::log($col->getIncrementId() . ' order deleted '); try { $col->delete(); } catch (Exception $e) { throw $e; } }
Initial URL
http://www.magentocommerce.com/boards/vie/viewthread/2960/#t259879
Initial Description
Say you don’t want to reset ALL your orders, maybe you want to PRUNE a production database. if that’s the case, this php file (added to a crontab, or ran from your magento root directory) will DELETE all cancelled orders (5000 limit per instance). This is helpful for production instances, to keep your magento running smoothly if you run alot of test transactions.
Initial Title
Delete cancelled magento orders cron
Initial Tags
magento
Initial Language
PHP