1

I have created an observer that hooks into the controller_action_predispatch_adminhtml_sales_order_view event. In this observer I want to set the order's hasForcedCanCreditmemo to TRUE.

I am unsure how to retrieve the order, though - I can't see anywhere that the order ID is being passed through.

Does anyone have any ideas as to how I would get the order?

Thanks!

2

In your observer class you can do the following:

public function changeOrder(Varien_Event_Observer $observer)
{
    $orderId = $observer->getControllerAction()->getRequest()->getParam('order_id');
    $order = Mage::getModel('sales/order')->load($orderId);
}

Thus, you will have your order available in the $order variable.

| improve this answer | |

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.