1

I want to override Mage_Adminhtml_Controller_Action in my module Mycompany_Mymodule.

I've searched the net,but I couldn't find anyway to do this. Is it like the controllers, or it has a different way?

I appreciate any help.

2

1 Answer 1

5

You cannot override that controller.
Well...actually you can but it will have no effect.
The Mage_Adminhtml_Controller_Action class is never instantiated. It is there as a common parent class for the rest of the admin controllers.
even if you find a way to rewrite it all the other admin controllers will extend the original class so your modification will be useless.

If you want to change something in it you have to copy it to app/code/local/Mage/Adminhtml/Controller/Action.php and make your modifications there.

Here are more details about why you cannot rewrite some classes in Magento

1
  • i dont think there should be ever a need to override abstract class in magento(correct me if i am wrong)..as u mentioned factory method access classes which are extended from abstract classes(not all of course!) so these methods can always be extendable.
    – huzefam
    Commented Jun 6, 2014 at 15:20

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.