0

How can I change order state from processing to closed in Magento 1.9?

Normal Magento workflow says that we can get status as closed after creating the credit memo. In my application, I can create credit-memo for 2 cases: Store credit or online refund. But I want another case where I want to refund customer money via cheque and mark that order as closed. But this is not in Magento workflow.

Any idea to accomplish this would be a great help!

1

Create new order status and assign to close state.

Check following url

Change order status

In this example they explain for pending status. I think it may help you.

For change state, i think you need to add new action in dropdown and on select newly created action you have to write code for change state. For add new label in action dropdown, please check following post. They have added "Invoice capture online ". Add you custom label.

http://misc.ws/2014/12/27/adding-mass-actions-to-magento-orders/

In controller massInvoiceCaptureOnlineAction() write your logic for closed. Here is that code.

$orderId = YOUR_ORDER_ID;
$order = Mage::getModel('sales/order')->load($orderId);
$order->setState(Mage_Sales_Model_Order::STATE_CLOSED, true)->save();

Please Check massInvoiceCaptureOnlineAction() code, you will get order ids. You just have to replace capture invoice code with above code.

I hop this will help you.

  • Your post is about M2, the issue is about M1 , check the post's description – Attila Naghi May 23 '18 at 11:30
  • Yes, it's my mistake. But same functionality is available in M1 also. It may in different menu But functionality is available in M1. – user55548 May 23 '18 at 11:32
  • @Chester I have change reference site url. Not it will for M1 – user55548 May 23 '18 at 11:34
  • @user55548 I needed help in changing order state not order status. – Anurag Khandelwal May 24 '18 at 5:30
  • @AnuragKhandelwal Please check my answer. I have edit my answer for order state. – user55548 May 24 '18 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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