我需要从magento后端和用户面板中删除测试订单。我找到了一个有用的想法,但由于某些原因它不起作用。你能建议解决这个问题吗?
<?php
require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
//replace your own orders numbers here:
$test_order_ids=array(
'200000091',
'200000090',
'200000089',
'200000088',
'200000087',
'200000086'
);
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.";
?>
<?php
$today = getdate();
print_r($today);
?>