0

I have Collect In Store extension installed on Magento 1.9.0.1. The client wants a different default order status when this shipping method is chosen - it should be Processed instead of Pending. I could change the status on sales_order_place_after event like:

public function changeOrderStatus($event)
{
    $order = $event->getOrder();

    if ($order->getData('shipping_method') == 'collectinstore_collectinstore') {
        $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
        $order->save();
    }
    return $this;
}

But in this case the order's default status still will be Pending and later changed to Procssed. Also the customer will receive an email for status Pending but not for status Processed. So is it safe enough to change the order status before saving the order (sales_order_save_before event)? And if so, how I can stop the email notification on status Pending and send it when changing the status to Processed? On the other side it is not mentioned anywhere on the email (New order email) that the status is Pending or something else. So it seems okay to send it the first time and then just change the status to Processing but I'm still not sure if it's good enough.

Edit: What I was trying to achieve has nothing to do with changing the status of the order. My question is somehow wrong. Accepted R.S's answer below because he helped me to understand that I don't have to change the status with observer at all.

1 Answer 1

1

A order should not be set to 'Processing' until the payment is received because until payment is received the 'state' is 'new' and to set it to 'processing' the 'state' need to be 'processing'.

In your system config Admin -> system -> config -> Payment Methods -> {Payment Name} -> New Order Status

Order Process Mode = "Authorize Only" then New order Status = "pending" Order Process Mode = "Authorize & Capture" then New order Status = "processing"

Take a look at http://www.mexbs.com/magento-order-statestatus-flow/

enter image description here

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 method, you, may be notified when the transaction is authorized and in some cases, processed. The status of the order is now "Processing" and order can not be cancel and you will need to issue a credit using Credit Memos see http://www.magentocommerce.com/knowledge-base/entry/order-process-overview

11
  • We will use SagePay for the payments (credit/debit cards + PayPal). The money will be captured instantly. But the module it's not installed yet.
    – enenen
    Commented Oct 20, 2014 at 13:53
  • When changing 'status' you need to also update to the appropriate 'state', otherwise you will have issues when adding comment to order (it will change back to the default 'status' for that 'state') Commented Oct 20, 2014 at 13:55
  • As I understand I have to change the state and then the status will be changed, too? Ok, but how can I do that?
    – enenen
    Commented Oct 20, 2014 at 14:17
  • 1
    Once an invoice is generated (i.e payment received) then it should be processing Commented Oct 20, 2014 at 14:58
  • 1
    Yes. "Authorize and Capture" should generate an invoice Commented Oct 20, 2014 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.