Magento Set Order Status

Source: Internet
Author: User

<?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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.