Php script for delete particular status order from admin in magento
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', 'closed')->load();
foreach ($collection as $col) {
Mage::log($col->getIncrementId() . ' order deleted ');
try {
$col->delete();
} catch (Exception $e) {
throw $e;
}
}
change the status for whatever order you want to delete.. eg. if you want to delete 'closed' order than in addFieldToFilter status write 'closed' for complete 'completed' so on..
No comments:
Post a Comment