To delete test order from magento:
- Login to Admin Panel and go to Sales-->Orders.
- Note down your test order ids, for example: 100000001,100000002,100000003,100000111,100000112,100000199
- Now create a php file in magento root directory and name it: deleteOrders.php
-
Now copy below code and paste it in your file:
<?phprequire 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false); //replace your own orders numbers here:
$test_order_ids=array(
'100000001',
'100000002',
'100000003',
'100000109',
'100000112',
'100000134'
);
foreach($test_order_ids as $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."?>
-
Now go to your browsers address bar and run file from here like:
[Your_Magento_Base_URL] /deleteOrders.php
-
At the end, delete deleteOrders.php.
That's All.. Cheers :)
2 comments:
Sorry It will show again in sales order list of admin...But if we click on this it will showing error like "This order no longer exists."
I have to delete that list also
Ple help me
Same problem for me also :(
Post a Comment