Magento orders: states and statuses

 

Magento orders have different states for following their process (billed, shipped, refunded...) in the order Workflow. These states are not visible in Magento back office. In fact, it is orders statuses that are displayed in back office and not their states.

Each state can have one or several statuses and a status can have only one state. By default, statuses and states have often the same name, that is why it is a little confusing. Here is the list of statuses and states available by default.

State code State name Status code Status name
new New pending Pending
pending_payment Pending Payment pending_paypal
pending_amazon_asp
Pending PayPal
Pending Amazon Simple Pay
processing Processing processing Processing
complete Complete complete Complete
closed Closed closed Closed
canceled Canceled canceled Canceled
holded On Hold holded On Hold

For adding new status to a state, you just need to declare it in config.xml file

 

 

<config>
...
<global>
<sales>
<order>
<!-- Statuses declaration -->
<statuses>
<my_processing_status translate="label"><label>My Processing Status</label></my_status>
</statuses>
<!-- Linking Status to a state -->
<states>
<processing>
<statuses>
<my_processing_status/>
</statuses>
</processing>
</states>
</order>
</sales>
</global>
</config> 

 

When we want to modify order status in some code, we have to be sure that current order state allows status wanted. It is possible to change both state and status with setState method

 

$order = Mage::getModel('sales/order')->loadByIncrementId('100000001');
$state = 'processing';
$status = 'my_processing_status';
$comment = 'Changing state to Processing and status to My Processing Status';
$isCustomerNotified = false;
$order->setState($state, $status, $comment, $isCustomerNotified);
$order->save(); 

 

$status can also take false value in order to only set order state, or true value for setting status by taking first status associated to this state.

You can now adjust as you wish your order workflow in Magento.

 

源文:http://blog.baobaz.com/en/tag/magento-state-and-status

时间: 2024-08-22 15:21:16

Magento orders: states and statuses的相关文章

magento 开发 -- 新增一个简单的退货流程

       在现有的Magento系统中,客户在前台并没有一个可以申请退货的地方,退货操作只能由商家一方在后台操作.应客户需求,我为系统新增了一个前台客户可以申请退货的功能,并新增一个订单状态来保存客户申请之后的订单状态,下面简单描述下流程.        1.新增一个订单状态         Magento的订单状态是由配置文件中配置的,打开config.xml文件,在global标签中新增如下代码   <sales> <order> <statuses> <

magento 1.4-- 1.3时代常用插件兼容性测试

     在magento1.3时代有不少常用的插件,在Magento更新到1.4后许多插件的作者并没有将插件更新为支持1.4的版本(是否支持1.4官网上有标注),那是否这些插件在1.4就不能用了呢?来看看我的测试结果吧         首先推荐一个作者更新了后官方注明支持1.4的插件:MW_DeveloperToolbar,开发必备插件之一,可以方便的开启前后台模板,详见: http://www.magentocommerce.com/module/2271/developer-toolbar

Magento - GRID FILTER FOR COLUMNS WITH COMPLEX VALUES

In previous articles we told you how to operate with columns in adminhtml grids. Usually the process is quite fast, for example, if you want to add simple column from the database. But sometimes you need to add column with complex value, processed by

magento -- Magento事件一览表

Magento Module Event Name Parameters Mage Admin   admin_session_user_login_success array('user'=>$user) Mage Admin admin_session_user_login_failed array('user_name'=>$username, 'exception' => $e) Mage Admin admin_user_authenticate_after array('us

magento -- 隐藏国家语言列表,只保留中英文

Magento后台自身携带了一个语言切换的功能,见后台左下角          你会发现长长的一串,其中绝大多数语言你可能根本没有机会用到,而你想要从中文切换到英文时,每次都要瞪大眼睛去找英文在下拉框的哪个位置,所以精简下还是有必要的. 以我自己的需求为例,我需要使用中文后台,偶尔会切换到英文,因为有些翻译不理想需要看下原文,那我就只保留"中文 (中国)"和"英文 (美国)".打开根目录下/lib/Zend/Locale/Data/zh.xml文件,在大概640行找

Magento认证工程师考试及注册流程

Magento公司在2011年下半年推出了Magento认证工程师考试, 其分为两个级别Magento Certified Developer和The Magento Certified Developer Plus, 费用都是一样的每科$260. 至于通过考试的好处,我在这里就不多说了, 有兴趣的同学可以看这里: http://www.magentocommerce.com/certification/的关于Benefits描述. 据公司老大4月分参加一年一度的Magento大会" Imagi

Magento加速利器——lazyload

  Magento的速度是令人头疼的问题,我现在介绍一种前端的加速方法.说到lazyload,相信很多人都不陌生,现在很多网站都已经用到这个技术,他可以延迟加载长页面的图片.对于Magento这样的商城网站的加速就很明显了.我今天说的这个lazyload是经过POPO改造的(强逼我给他加外连--).下面我放一些测试的数据,我正在做的一个网站的列表页. 很明显的就能看出差距.接下来写下用法: 首先加上jQuery,lazyload两段js. lazyload: (function($) { $.f

magento根据距离计算运费模块

问题描述 magento根据距离计算运费模块 首先我是菜鸟,基本上不会php.但是已经摸索magento两个月,多少能看懂点php代码,以及magento的整个框架.我现在需要做的是配置一个根据距离计算运费的模块,比如三公里内五块钱,三公里外十块钱.我想知道有没有magento大神做过类似的工作,可否给点指导性意见!!!!

magento -- 推荐插件 -- 智能版Js和Css合并 --Lesti::Merge(Smart Merging of Js and Css)

名称:   Lesti::Merge(Smart Merging of Js and Css) Extension Key:http://connect20.magentocommerce.com/community/Lesti_Merge 网址:    http://www.magentocommerce.com/magento-connect/lesti-merge-2265.html 介绍:   基于Magento原生的合并JS和CSS功能,提供更聪明更智能的JS和CSS合并方案,可以根据