3

I'd like to add a hook to a Magento core action (in this specific case Mage_Adminhtml_Sales_Order_CreateController::saveAction() but I hope there's a general solution).

Just a hunch, but it seems to me that there should be a way to add a hook to an action using Magento's XML, without having to override a class just to add a one-line Mage::dispatchEvent(). Perhaps this is wishful thinking.

Is there any way to do this using XML? Or no? If so, how?

1 Answer 1

4

Good news: you don't need to rewrite controllers to listen for it to be called. Magento has dynamic eventing that are called both before and after a controller action is fired.

In your case all you would have to listen for is controller_action_predispatch_adminhtml_sales_order_create_save.

In the case that you would want to listen for after the action has completed and just prior to the request completion, you would change predispatch to postdispatch.

More reading: https://magento.stackexchange.com/a/5614/336

0

Your Answer

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

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