問題描述
我用 magento 制作了一個網(wǎng)站.現(xiàn)在它已上線,我想刪除所有測試訂單.我知道有一些表按所有這些順序存儲.但我不知道那些表的名字.如果某個正文有任何可以刪除所有訂單數(shù)據(jù)的腳本.
I have made a website in magento. Now it is live and I want to delete the all test order. I know there are some table in all these order are stored. but I don't know the name of those table. If some body has any script which can delete the all the order data.
請給我或請?zhí)峒八写鎯τ唵涡畔⒌谋淼拿Q
Please give me or please mention the name of all the tables which stores the order information
推薦答案
- 轉(zhuǎn)到管理>銷售>訂單
- 寫下您的測試訂單增量 ID,例如100000001,100000002,100000003,100000111,100000112,100000199
- 現(xiàn)在在 magento 根目錄中創(chuàng)建一個 php 文件并將其命名為:remove_test_orders.php
粘貼以下代碼:
- Go to admin>sales>orders
- Write down your test orders incremental ids, for example 100000001,100000002,100000003,100000111,100000112,100000199
- now create a php file in magento root directory and name it: remove_test_orders.php
Paste the code below:
require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
//replace your own orders numbers here:
$test_order_ids=array(
'100000001',
'100000002',
'100000003',
'100000111',
'100000112',
'100000199',
);
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.";
現(xiàn)在轉(zhuǎn)到命令行并運(yùn)行:
Now go to command line and run:
php remove_test_orders.php
php remove_test_orders.php
最后刪除remove_test_orders.php.
At the end, delete remove_test_orders.php.
這篇關(guān)于如何從 magento 中刪除測試訂單的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!