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 "\r\n";
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代码文件app\code\core\Mage\Sales\Model\Order.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 <[email protected]>
 */
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‘;

// ...
}
</[email protected]>

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

时间: 2024-08-03 03:00:53

magento设置订单状态的相关文章

如何在magento后台增加一个自定义订单状态

magento后台订单状态(order status)只有Pending.Processing.On Hold.Closed.Canceled.Pending Payment 等等,如何在magento后台增加一个自定义订单状态呢?下面最模板以增加一个”On Shipping” 为例: 1.首先你需打开app/code/core/Mage/Sales/etc/config.xml 文件找到大概第545行,在之间插入一行自定义状态代码: <statuses> <pending transl

Magento后台手动修改订单状态方法

订单详细内容页手动修改订单状态方法: 打开此文件:app\design\adminhtml\default\default\template\sales\order\view\history.phtml 34行位置为如下原本内容: <?php foreach ($this->getStatuses() as $_code=>$_label): ?> 修改为: <?php foreach (Mage::getSingleton('sales/order_config')->

ecshop订单状态对应值详解

ecshop的订单状态都是在ecs_order_info表中的字段里. 订单状态 未确认 取消 确认 已付款 配货中 已发货 已收货 退货 order_status 0 2 1 1 1 5 5 4 shipping_status 0 0 0 0 3 1 2 0 pay_status 0 0 0 2 2 2 2 0 1.ecshop订单状态对应值简单版: order_status = 0表示订单未确认 order_status = 1表示订单已经确认 order_status = 2表示订单已经取

ECSHOP 订单状态 记录

记录订单状态 order_status /* 订单状态 */ define(‘OS_UNCONFIRMED’,            0); // 未确认 define(‘OS_CONFIRMED’,              1); // 已确认 define(‘OS_CANCELED’,               2); // 已取消 define(‘OS_INVALID’,                3); // 无效 define(‘OS_RETURNED’,          

ECSHOP的订单状态在数据库中的表现(order_status, shipping_status, pay_status)

echop的订单状态都是在ecs_order_info表中的字段里. 订单状态 未确认 取消 确认 已付款 配货中 已发货 已收货 退货 order_status 0 2 1 1 1 5 5 4 shipping_status 0 0 0 0 3 1 2 0 pay_status 0 0 0 2 2 2 2 0

给 magento 后台订单加入详情预览

一. 后台订单列表grid页 二. 后台订单View页 1) 加入图片预览. 修改  app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml, 在 <?php if ($this->canDisplayContainer()): ?>  之前插入: <div style="width:60px;height:60px;float:left;dis

即时设置数据库状态

在设置数据库状态时with子句忽略,则当数据库中存在任何锁时,ALTER DATABASE 语句将无限期等待.with NO_WAIT ,指定若有事务还没有提交,则立即失败,不再进行下面的操作with ROLLBACK AFTER integer [SECONDS] | ROLLBACK IMMEDIATE:指定是在指定秒数之后回滚还是立即回滚. 注意:并非所有数据库选项都使用 WITH <termination> 子句,也不是所有数据库选项都能结合其他选项指定. ALTER DATABASE

SHOPKEE 微信支付,订单状态显示未支付 修复

公众号支付 --> H5调起支付API 1 function onBridgeReady(){ 2 WeixinJSBridge.invoke( 3 'getBrandWCPayRequest', { 4 "appId" : "wx2421b1c4370ec43b", //公众号名称,由商户传入 5 "timeStamp":" 1395712654", //时间戳,自1970年以来的秒数 6 "nonceStr

R语言diagram包画订单状态流图

代码如下: library("diagram") #a <- read.table(file="clipboard",header=TRUE) write.table(a,file="a.txt",sep=";") aa <- a c <- matrix(nrow=ncol(aa),ncol=ncol(aa),0) i <- 1 while(i<=ncol(aa)){ j <- 1 whil