Friday, 8 June 2012

Order Delete in magento

 First a make a folder in Root Directory folder is order-->delete.php

 run this Browser look like http://www.your project name/order/delete.php
  <?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

Note: only a member of this blog may post a comment.