【问题标题】:How to remove test orders in Magento?如何在 Magento 中删除测试订单?
【发布时间】:2014-09-23 21:56:53
【问题描述】:

我需要从 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);
?>

【问题讨论】:

    标签: php magento


    【解决方案1】:

    我建议使用this extension,(它是免费的:-))。您永远不知道何时需要删除其他订单。

    【讨论】:

    • 我使用扩展来完成同样的事情。非常适合我。
    猜你喜欢
    • 1970-01-01
    • 2016-10-18
    • 1970-01-01
    • 2012-09-16
    • 2013-12-23
    • 2012-10-20
    • 2019-04-23
    • 2013-02-26
    • 1970-01-01
    相关资源
    最近更新 更多