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.

asked Apr 9, 2014 at 6:44
2
  • Pls have a look at stackoverflow.com/questions/6374344/… Commented Apr 9, 2014 at 6:46
  • 1
    thanks for the link, but it is about controllers folder, but I am talking about Controller folder, I mean the abstract controllers Commented Apr 9, 2014 at 6:51

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

answered Apr 9, 2014 at 6:53
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. Commented Jun 6, 2014 at 15:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.