<?php
Require_once (' app/mage.php ');
Umask (0);
Mage::app (' Default ');
er = Mage::getmodel (' Sales/order ');
er->loadbyincrementid (100000001); 100000001 for order number
Get Order Status
$status = er->getstatus ();
$state = er->getstate ();
Echo $status;
echo "\ r \ n";
Echo $state;
Set Order Status
er->setstatus (mage_sales_model_order::state_processing);
er->save ();
Magento orders have two status variables: state and status, which is confusing, only the test, then a single, and then in the Magneto background processing orders, the following Magento order status values.
1. New orders
State:new
Status:pending
2. After delivery
State:processing
Status:processing
3. After collection
State:processing
Status:processing
4. Order Completion
State:complete
Status:complete
5. Order Cancellation
State:canceled
Status:canceled
6. Order Closure
State:closed
Status:closed
7. Order Pending
state:holded
status:holded
8. Order status introduced during payment (Paypal, Amazon pay)
State:pending_payment
Status:p Ayment_review
Magento Order Status is defined as a status constant that defines an order in the Magento code file 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]>
Among them, Pending_payment, Payment_review is the order status introduced during the payment (Paypal, Amazon pay) process.
Magento Set Order Status