-1

I need to set awaiting shipment after shipment clicked instead of complete.

1
  • 1
    @Manashvibirla : make sure after ship clicked status changed awaiting shipment, right after manually change "complete"
    – Gem
    Dec 22 '16 at 6:09
1

Creating shipment of an order in Magento changes the order status to Complete and state complete while invoice is already created. So first you need to create a new order status awaiting shipment and assign it to complete state from admin System > Order Statuses.

Now admin can change the order status manually from order edit detail spage bottom left comment section.

But, I guess you are looking for any automated code solution. So here the deal is, you need to use order save after event to change the order status.

You need to use the event sales_order_shipment_save_after and in your observer method you need to get the order and change the order status and save. The event is defined at

app/code/core/Mage/Core/Model/Abstract.php

protected function _afterSave()
{
    $this->cleanModelCache();
    Mage::dispatchEvent('model_save_after', array('object'=>$this));
    Mage::dispatchEvent($this->_eventPrefix.'_save_after', $this->_getEventData());
    return $this;
}

here $this->_eventPrefix is sales_order_shipment defined at

app/code/core/Mage/Sales/Model/Order/Shipment.php

In your observer method, you need use method setState from order model /app/code/core/Mage/Sales/Model/Order.php to save your newly created save.

public function setState($state, $status = false, $comment = '', $isCustomerNotified = null)
{
    return $this->_setState($state, $status, $comment, $isCustomerNotified, true);
}

I assume you have experience in M1 development. Dont forget to post comment if you need more help on this.

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