• magento设置订单状态


    <?php

    require_once('app/Mage.php');
    umask(0);
    Mage::app('default');

    $order = Mage::getModel('sales/order');
    $order->loadByIncrementId(100000001);  // 100000001为订单编号

    // 获取订单状态
    $status = $order->getStatus();
    $state  = $order->getState();

    echo $status;
    echo " ";
    echo $state;

    // 设置订单状态
    $order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
    $order->save();

    Magento订单 有两个状态变量:state和status,这让人困惑,只有测试下了,于是下了个单,然后在Magneto后台处理订单,得出下面的Magento订单状态值。

    1. 新订单
    state  : new
    status : pending

    2. 配送后
    state  : processing
    status : processing

    3. 收款后
    state  : processing
    status : processing

    4. 订单完成
    state  : complete
    status : complete

    5. 订单取消
    state  : canceled
    status : canceled

    6. 订单关闭
    state  : closed
    status : closed

    7. 订单挂起
    state  : holded
    status : holded

    8.支付(Paypal, Amazon Pay)过程中引入的订单状态

    state  : pending_payment

    status :payment_review 
     

    Magento订单状态 是定义在Magento代码文件appcodecoreMageSalesModelOrder.php中定义了订单的状态常量:

    /**
     * Order model
     *
     * Supported events:
     *  sales_order_load_after
     *  sales_order_save_before
     *  sales_order_save_after
     *  sales_order_delete_before
     *  sales_order_delete_after
     *
     * @author Magento Core Team <core@magentocommerce.com>
     */
    class Mage_Sales_Model_Order extends Mage_Sales_Model_Abstract
    {

        /**
         * Order states
         */
        const STATE_NEW             = 'new';
        const STATE_PENDING_PAYMENT = 'pending_payment';
        const STATE_PROCESSING      = 'processing';
        const STATE_COMPLETE        = 'complete';
        const STATE_CLOSED          = 'closed';
        const STATE_CANCELED        = 'canceled';
        const STATE_HOLDED          = 'holded';
        const STATE_PAYMENT_REVIEW  = 'payment_review'; // added magento 1.4

        /**
         * Order flags
         */
        const ACTION_FLAG_CANCEL    = 'cancel';
        const ACTION_FLAG_HOLD      = 'hold';
        const ACTION_FLAG_UNHOLD    = 'unhold';
        const ACTION_FLAG_EDIT      = 'edit';
        const ACTION_FLAG_CREDITMEMO= 'creditmemo';
        const ACTION_FLAG_INVOICE   = 'invoice';
        const ACTION_FLAG_REORDER   = 'reorder';
        const ACTION_FLAG_SHIP      = 'ship';
        const ACTION_FLAG_COMMENT   = 'comment';

        // ...
    }
    </core@magentocommerce.com>

    其中,pending_payment, payment_review 是支付(Paypal, Amazon Pay)过程中引入的订单状态。

  • 相关阅读:
    ZOJ
    CodeForces
    模板
    前门
    错误记录
    2021/1/10例会 academy of management journal 2014vol 57 No.2,484-514
    Day7下
    Day7上
    Day6 下(
    Day6上 括号匹配专项
  • 原文地址:https://www.cnblogs.com/focai/p/4341241.html
Copyright © 2020-2023  润新知