Paste it in a file and place it in root and run. It will delete all canceled order from your magento store.
<?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;
}
}
?>
<?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;
}
}
?>
No comments:
Post a Comment