40

According to "The Definitive Guide to Magento" [1], the order statuses are defined as follows: Pending: Pending orders are brand new orders that have not been processed. Typically, these orders need to be invoiced and shipped. Pending PayPal: Pending PayPal orders are brand new orders that have not been cleared by PayPal. [...] Processing: ...


26

The first time I got an out of sequence number, we had surprise and some dismay until I figured out what was happening. It has to do with how Magento allocates Sales Order numbers. It's entirely normal to have one out of sequence like that, be previous to the current allocated numbers and a month or more old. The secret to it is that it was a logged in ...


14

Take a look at http://www.mexbs.com/magento-order-statestatus-flow/ Order "Pending" From the Admin panel, the sales order appears in the Order list as "Pending". At this point, payment has not been processed, and the order can still be canceled. Payment Received The status of the order remains "Pending" until payment is received. Depending on the payment ...


12

It's not allowed to manually set the order state to 'complete' and you should be getting this exception when you call setState on the order with the 'complete' state: The Order State "complete" must not be set manually. The reason for this is simple: The 'complete' state (and status, since it's the only state with a status of 'complete') is intended to ...


10

As far as I know, we can use events: sales_order_save_after and sales_order_state_change_before. I refer sales_order_save_after event. In our observer, we can get the state of order: Observer/SalesOrderAfterSave.php public function execute(\Magento\Framework\Event\Observer $observer) { $order = $observer->getEvent()->getOrder(); if ($order ...


9

Echoing $order is trying to print the entire order object. Also it seems like the actual order object isn't being loaded properly. What you want is: <?php $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId()); ?> <p><?php echo $order->getId(); ?></p>


9

Below are the status's you can use const STATE_NEW = 'new'; const STATE_PENDING_PAYMENT = 'pending_payment'; const STATE_PROCESSING = 'processing'; const STATE_CLOSED = 'closed'; const STATE_CANCELED = 'canceled'; const STATE_HOLDED = 'holded'; const STATE_PAYMENT_REVIEW = 'payment_review'; Code for updating the ...


9

Even though using the OrderFactory would work, save and load methods are deprecated soon, you should use service contracts instead. So you can use Magento/Sales/Api/OrderManagementInterface: First inject an instance in your class constructor: protected $orderManagement; public function __construct( ... \Magento\Sales\Api\OrderManagementInterface $...


8

Order status/state Closed/closed is a "protected" status/state, which cannot be changed, along with Complete/complete. This means when you use the method setState, it will not work. This is because in order to have a Closed order, you must have a fully invoiced and shipped order fully refunded. It looks like in your case you don't have a full shipment. If ...


7

We ended up coding a module to rewrite the core IPN Model which suppresses the automatic creation of Credit Memos when a Paypal Refund is issued. Instead, it adds an Order Comment with the Paypal Transaction ID (for reconciliation) and raises an Admin Notification that the administrator should manually create an Offline Credit Memo to correlate with the ...


7

It sounds like your incoming orders are assigned a state of pending_payment until the invoice is added. If you take a look at /app/code/core/Mage/Sales/etc/config.xml <config> <global> <sales> <order> <states> <new translate="label"> <...


7

The easiest way to think about how Magento processes all the orders is first knowing that Magento uses an internal order state and a status. States: new: This order is new, unprocessed, not picked up by the payment gateway or anything. pending_payment: Payment is being processed by the payment gateway (this should always automatically resolve if the ...


7

you can add state by simply add xml code in your module config.xml <global> <sales> <order> <states> <order_recieved translate="label"> <label>Order Recieved</label> <statuses> <order_recieved default="1"/> </statuses> ...


7

No, because it is a 1:n association, there are multiple statuses per state. You can, however, get a list of all statuses that are assigned to a state $stateCode, and their names, with: $statuses = Mage::getResourceModel('sales/order_status_collection') ->addStateFilter($stateCode) ->toOptionHash(); $statuses then contains an array in the ...


7

I got solution code as below: /** * @var Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $statusCollectionFactory */ protected $statusCollectionFactory; /** * Construct * * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Sales\Model\ResourceModel\Order\Status\...


7

We can assign the New Order Status. I will give some basic info: Login to Magento Admin > STORES > Configuration > SALES > Payment Methods > Choose the Payment, you will see the config for the New Order Status: Create the New Order status: STORES > Order Status, we can create a new status for the custom payment. And then, we need to assign this status to ...


6

Open file app/code/core/Mage/Sales/etc/config.xml and find node. Inside this node, add following. <mystate translate="label"> <label>My State</label> <statuses> <mystatus default="1"/> </statuses> <visible_on_front>1</visible_on_front> </mystate> Note : I don't recommend to ...


6

You can use the join method on the getSelect object $collection = Mage::getResourceModel('sales/order_item_collection') ->addAttributeToSelect('*'); $collection->getSelect()->join( array('orders'=> sales_flat_order), 'orders.order_id = main_table.order_id', array('orders.status')); // join on orderid and retrieve the status column ...


6

The reason that your Pending order cannot be switched to Processing is that Pending order status has pending order state associated with it. Processing status has processingstate associated with it in default Magento. Order states cannot be changed in the admin panel, as it disrupts the business logic of Magento. So, you should only manually change state ...


6

This is more complicated than it sounds. Cancellation while pending is easy. The method is described in Cancel Order from magento 2 frontend? and I've implemented it in a module with the template tweaks needed (and confirmation dialogues). https://github.com/lingwooc/cancel-magento2 You should note this only works for pending orders. Most orders (...


6

In your payment method model you can add protected $_isInitializeNeeded = true; In Magento\Sales\Model\Order\Payment, you will see : public function place() { .... if ($methodInstance->isInitializeNeeded()) { $stateObject = new \Magento\Framework\DataObject(); // For method initialization we have to use original config value ...


5

In the configuration for the statuses you can provide label translations on a per-store basis (from the backend): In System > Order Statuses > [Click on Status]:


5

I would not delete the order but just cancel them and with a cronjob (either a script or Magento extension) you can do this. Run it daily to clean up the orders. Results are logged to var/logs/cancelorders.log for reference. $collection = Mage::getModel('sales/order')->getCollection() ->addFieldToFilter('updated_at', Mage::getModel('core/date')-&...


5

This is the correct behavior by default. You can only change a status of an order to one of the statuses available for the order state. (Do not confuse order state with order status). In order to have more available statuses, add your new status from System->Order statuses. Then click on the same page on the button Assign status to state, select your new ...


5

If you take a look at magento Order Workflow, a order will remain in the processing until it is ship (If your order is not invoice then you will not be able to complete the order until it is invoice)


5

If you look at the config.xml of Mage_Sales module, you'll see /** * @depraceted after 1.4.2, statuses are saved into sales_order_status table */ <statuses> ... Order statuses and states are saved in the database. There should be plenty of references on how to add them manually or programmatically. Here is one http://www.techytalk.info/...


5

You need to inject \Magento\Sales\Api\OrderRepositoryInterface class to get order status In Your Block protected $orderRepository; public function __construct( ... \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, ... ) { ... $this->orderRepository = $orderRepository; ... } ...


5

First create new status Stores > Order Status and set the code for status custom_cancel and use below code $orderId = 3; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('\Magento\Sales\Model\Order')->load($orderId); $state = $order->getState(); $status = '...


4

Take a look @ Magento: Difference between order states and statuses State is used by magento to tell if the order is new, processing, complete, closed, canceled, etc.; Each 'state' can have multiple 'statues', for example 'processing' (after payment is received) you could additional 'statuses' to match you business work flow ('order in production', 'order ...


4

Also, you can create the status via System > Order Statuses > Create New Status, and then assign the status to a state (System > Order Statuses > Assing Status to State).


Only top voted, non community-wiki answers of a minimum length are eligible