簡體   English   中英

如何在Magento中刪除測試訂單?

[英]How to remove test orders in Magento?

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

我建議使用此擴展名 ,(它是免費的:-))。 您永遠不知道什么時候需要刪除其他訂單。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM