Return to Snippet

Revision: 41833
at February 23, 2011 20:55 by hotdiggity

Initial Code

Mage::getSingleton("core/session", array("name" => "adminhtml"));
 $collection = Mage::getResourceModel('sales/order_collection')
            ->addFieldToFilter('status', 'canceled')->load();

foreach ($collection as $col) {
  Mage::log($col->getIncrementId() . ' order deleted ');
    try {
    } catch (Exception $e) {
        throw $e;

Initial URL

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

Initial Language