Tuesday, September 8, 2015

Magento Delete Orders

require 'app/Mage.php';

Mage::app('admin')->setUseSessionInUrl(false);                                                                                      
$orderIds=Array = array('100000001','100000002','100000004','200000002');

for($cnt=0;$cnt<count($orderIdsArray);$cnt++)
{
    try
{
$OrderId=$orderIdsArray[$cnt];
        Mage::getModel('sales/order')->loadByIncrementId($OrderId)->delete();  
echo "Order #".$OrderId ." is removed"."<br />";
    }
catch(Exception $e)

        echo 'Error: '.$e->getMessage().'<br />';
}
}

No comments:

Post a Comment

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method... magento 2

Fatal error: Class Zend\Stdlib\Parameters contains 1 abstract method and must therefore be declared abstract or implement the remaining met...