<?php
require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
$sales_orders = Mage::getModel('sales/order')->getCollection()->getData();
foreach($sales_orders as $sales_order){
$id = 0;
$id = $sales_order['increment_id'];
try{
Mage::getModel('sales/order')->loadByIncrementId($id)->delete();
echo "order #".$id." is removed".PHP_EOL;
}catch(Exception $e){
echo "order #".$id." could not be remvoved: ".$e->getMessage().PHP_EOL;
}
}
echo "complete."
?>
Monday, 28 January 2013
How to delete all sales order in magento
In Magento Connect
you will find some extension which will delete all cancel order and
Pending Order, But it never delete all processed order. To delete all
orders following code snippet can be used.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment