0

I want to override in adminhtml controller action.php

I tried this

config.xml

<args>
                    <modules>
                        <Medma_MarketPlace before="Mage_Adminhtml">Medma_MarketPlace</Medma_MarketPlace>
                    </modules>
                </args>

Medma/Marketplace/controllers/adminhtml/action.php

My code is

require_once "Mage/Adminhtml/controller/Action.php";

class Medma_MarketPlace_Adminhtml_ActionController extends Mage_Adminhtml_Controller_ActionController 
{
do somthing

}

but nothing happen I think i do something wrong.

3
  • Depending on what you want to achieve, I suggest you can probably override a lower level admin controller instead of the entire Action.php file. Could you tell us what do you want to do ? – Raphael at Digital Pianism Jan 13 '16 at 12:32
  • i want to override a protected function _isAllowed() { //return Mage::getSingleton('admin/session')->isAllowed('admin'); return true; } – Arvind Jha Jan 13 '16 at 12:34
  • 2
    I suggest you avoid doing this. The _isAllowed function takes care of security in your backend and overriding it this would make your store vulnerable to attack. I suggest you read this: alanstorm.com/magento_acl_authentication – Raphael at Digital Pianism Jan 13 '16 at 12:41
1

Make code and folder,file like follwing

Medma/Marketplace/controllers/Adminhtml/ActionController.php

class Medma_MarketPlace_Adminhtml_ActionController extends Mage_Adminhtml_Controller_Action 
{
do somthing

}

Mage_Adminhtml_Controller_Action is a class that many other classes extend so it can't be easily overloaded (similar to base models or abstract classes).

If you really wanted to change this behavior you would have to copy and paste the entire source and place it inside of app/code/local/Mage/Adminhtml/Controller/Action.php.

It is recommend to follow "proper" Magento convention and implement the _isAllowed method in your custom controller classes. For securing 3rd party modules, the above approach will work but you will purposely make upgrading more difficult. A "cleaner" approach would be as you mentioned to rewrite each specific route's controller. This could involve a lot of effort and time, you have to draw the line appropriately for each project.

Source : How can you override Mage_Adminhtml_Controller_Action

9
  • I make same folder structure – Arvind Jha Jan 13 '16 at 12:35
  • You have wriiten adminhtml in lowercase. make it exactly same – Rohit Kundale Jan 13 '16 at 12:36
  • but nothing happen – Arvind Jha Jan 13 '16 at 12:37
  • what you want to achieve? – Rohit Kundale Jan 13 '16 at 12:38
  • adminhtml are exactly same no lower case – Arvind Jha Jan 13 '16 at 12:38

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.