Magento订单状态迷思
来源:互联网 发布:java工厂方法模式 编辑:程序博客网 时间:2024/05/21 10:49
Magento订单状态迷思
01
require_once
(
'app/Mage.php'
);
02
umask(0);
03
Mage::app(
'default'
);
04
05
$order
= Mage::getModel(
'sales/order'
);
06
$order
->loadByIncrementId(100000001);
// 100000001为订单编号
07
08
// 获取订单状态
09
$status
=
$order
->getStatus();
10
$state
=
$order
->getState();
11
12
echo
$status
;
13
echo
"\r\n"
;
14
echo
$state
;
15
16
// 设置订单状态
17
$order
->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
18
$order
->save();
订单有两个状态变量:state和status,这让人困惑,只有测试下了,于是下了个单,然后在Magneto后台处理订单,得出下面的状态值。
01
1. 新订单
02
state : new
03
status : pending
04
05
2. 配送后
06
state : processing
07
status : processing
08
09
3. 收款后
10
state : processing
11
status : processing
12
13
4. 订单完成
14
state : complete
15
status : complete
16
17
5. 订单取消
18
state : canceled
19
status : canceled
20
21
6. 订单关闭
22
state : closed
23
status : closed
24
25
7. 订单挂起
26
state : holded
27
status : holded
在Magento代码文件app\code\core\Mage\Sales\Model\Order.php中定义了订单的状态常量:
01
/**
02
* Order model
03
*
04
* Supported events:
05
* sales_order_load_after
06
* sales_order_save_before
07
* sales_order_save_after
08
* sales_order_delete_before
09
* sales_order_delete_after
10
*
11
* @author Magento Core Team <core@magentocommerce.com>
12
*/
13
class
Mage_Sales_Model_Order
extends
Mage_Sales_Model_Abstract
14
{
15
16
/**
17
* Order states
18
*/
19
const
STATE_NEW =
'new'
;
20
const
STATE_PENDING_PAYMENT =
'pending_payment'
;
21
const
STATE_PROCESSING =
'processing'
;
22
const
STATE_COMPLETE =
'complete'
;
23
const
STATE_CLOSED =
'closed'
;
24
const
STATE_CANCELED =
'canceled'
;
25
const
STATE_HOLDED =
'holded'
;
26
const
STATE_PAYMENT_REVIEW =
'payment_review'
;
// added magento 1.4
27
28
/**
29
* Order flags
30
*/
31
const
ACTION_FLAG_CANCEL =
'cancel'
;
32
const
ACTION_FLAG_HOLD =
'hold'
;
33
const
ACTION_FLAG_UNHOLD =
'unhold'
;
34
const
ACTION_FLAG_EDIT =
'edit'
;
35
const
ACTION_FLAG_CREDITMEMO=
'creditmemo'
;
36
const
ACTION_FLAG_INVOICE =
'invoice'
;
37
const
ACTION_FLAG_REORDER =
'reorder'
;
38
const
ACTION_FLAG_SHIP =
'ship'
;
39
const
ACTION_FLAG_COMMENT =
'comment'
;
40
41
// ...
42
}
43
</core@magentocommerce.com>
其中,pending_payment, payment_review 没有测试到,后来发现是支付(Paypal, Amazon Pay)过程中引入的状态。具体请看Magento orders: states and statuses,文章阐述了Order States and Order Statuses的区别, 还有如何在Magento订单中增加自定义状态。
0 0
- Magento订单状态迷思
- 50.magento 订单状态
- magento 后台订单状态修改
- magento 修改订单状态为Completed
- magento修改订单状态、添加订单备注代码示例
- magento修改订单状态、添加订单备注代码示例
- magento -- 关于更新订单状态的API接口函数
- Magento SOAP API V2 开放接口修改订单状态
- Magento订单状态详解(一):Magento订单基本流程 http://www.php-source.com/thread-20100-1-1.html
- magento shell 脚本 通过api获取paypal的订单状态,同步到magento网站的订单,自动纠正不准确的订单状态
- Magento订单管理
- Magento 订单删除
- magento 删除订单
- Magento订单流程小记
- Magento 订单清空
- magento删除订单
- 订单状态
- magento 支付宝模块 当支付成功时在哪里更改订单状态的
- NYOJ--1105--sweets
- Android蓝牙通讯
- printf输出string
- C语言-全局变量与局部变量、全局函数与内部函数
- 服务器内存提示错误
- Magento订单状态迷思
- Angular 调用 WebApi 传参
- warning: function returns address of local variable
- 你需要知道的几个Git Command——Git中的后悔药
- 验证socket能否连接
- 在线编译
- Shell脚本入门(十二) - 将数据写入文件
- Spring Security 3.x完整入门配置教程及其代码下载
- LeetCodeOJ. Single Number