如何从 magento 中删除测试订单

how can I delete test order from magento(如何从 magento 中删除测试订单)
本文介绍了如何从 magento 中删除测试订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 magento 制作了一个网站.现在它已上线,我想删除所有测试订单.我知道有一些表按所有这些顺序存储.但我不知道那些表的名字.如果某个正文有任何可以删除所有订单数据的脚本.

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.

请给我或请提及所有存储订单信息的表的名称

Please give me or please mention the name of all the tables which stores the order information

推荐答案

  1. 转到管理>销售>订单
  2. 写下您的测试订单增量 ID,例如100000001,100000002,100000003,100000111,100000112,100000199
  3. 现在在 magento 根目录中创建一个 php 文件并将其命名为:remove_test_orders.php
  4. 粘贴以下代码:

  1. Go to admin>sales>orders
  2. Write down your test orders incremental ids, for example 100000001,100000002,100000003,100000111,100000112,100000199
  3. now create a php file in magento root directory and name it: remove_test_orders.php
  4. 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.";

  • 现在转到命令行并运行:

  • 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.

    这篇关于如何从 magento 中删除测试订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

  • 本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

    相关文档推荐

    Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
    in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
    all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
    trim function is giving unexpected values php(Trim函数提供了意外的值php)
    Basic PDO connection to MySQL(到MySQL的基本PDO连接)
    PHP number_format returns 1.00(Php number_Format返回1.00)