Magento: Create your own admin controller in a new tab

We have already seen in a previous post how to override a controller into Magento. This time I’ll show you how to create your own controller in admin panel in an efficiant way, because there are many solutions here and there but they do not always work and are sometimes obsolete. We will access our controller under a new custom tab.


Before showing you the code, here is what the admin panel will look like:

And here is the module structure:

Module configuration


<?xml version="1.0"?>
                <!-- Helper definition needed by Magento -->
                        <foo_bar before="Mage_Adminhtml">JR_CreateAdminController_Adminhtml</foo_bar>

Tabs and sub-tabs creation


<?xml version="1.0" encoding="UTF-8"?>
        <mycustomtab module="jr_createadmincontroller" translate="title">
            <title>My Custom Tab</title>
                <index module="jr_createadmincontroller" translate="title">
                    <title>Index Action</title>
                <list module="jr_createadmincontroller" translate="title">
                    <title>List Action</title>
                    <custom translate="title" module="jr_createadmincontroller">
                        <title>My Controller</title>
                            <index translate="title">
                                <title>Index Action</title>
                            <list translate="title">
                                <title>List Action</title>

Controller creation


class JR_CreateAdminController_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
    public function indexAction()
            ->_title($this->__('Index Action'));
        // my stuff
    public function listAction()
            ->_title($this->__('List Action'));
        // my stuff


Code of the extension is available on GitHub: Your turn now! ;)

31 Responses to “Magento: Create your own admin controller in a new tab”

  1. Ben Marks says:

    Might be good to point out that users will need to create the data helper class based on the translate arguments

    JR_CreateAdminController_Helper_Data extends Mage_Core_Helper_Data {}

  2. Rosario says:

    where’s the code of this extension ? thank you

  3. rohit says:

    how can i put my file path URL in this module please Suggest me …..

  4. Bharath says:

    Hey Rohit,

    Found any solution? I’m held up with the same.

  5. Wrong Answer says:

    Have Same Problem … Fatel error for helper_data.. though i make it..

  6. Afsana says:

    Nice Code…. But its not working….. :'( Please help me for this…..

  7. Sven Varkel says:

    Thanks for tutorial. I needed a little piece from there to remind me how adminhtml controllers are mapped:)

  8. asd says:

    LOL this one is also not working

  9. Rajib says:

    How to make sub->sub menu using this code. Please explain.

  10. Hélio says:

    this was very helpful your post, but you have the part of View?
    How do I list items from a database table, for example?

  11. andrei says:

    it doesn’t work…..

  12. andrei says:

    no, wait… sorry. It works.. I just needed to clear the catch. Thanks

  13. shilpa says:

    pls suggest …. its not working

  14. shilpa says:

    i followed the steps given above many times….but still not showing any menu item/tab in magento admin panel’s menu bar………plz help

  15. shilpa says:

    plz tell me how to give links on sub-tab…..

    • Mjx says:

      For Example:
      your Extension is in location: Mjx/Shipping
      Mjx is your Namespace and Shipping is your extension name
      and you have Controller : TestController.php in location Mjx/Shipping/controller/Adminhtml/
      and this controller will have method
      public function listAction() { die(‘test’) }

      So your main tab hould have



      … <– In this param you create link The value is adminhtml(always)/shipping(this is the name of router you defined in section)/list(this is action from controller)

      I hope this helped you

  16. Vikram says:

    I have tried your extension and it worked well , I have found one issue with the extension.

    If i set custom ROLE then other user with roles/permission not able to view this menu in his account. For admin its working fine , but any secondary user have permission to this module will not able to view it in his account.

    Any idea whats wrong ?

  17. Vikram says:

    must be

    only then ACl will work

  18. david says:

    It works fine and displayed tab in backend. how to add form fields in backend

  19. sreenu says:

    This tutorial very helpful thank you it’s working.
    I created menu and submenu
    in that i want to groups and fields(item)
    i tried but not getting
    please help me
    thank you

  20. bratati says:

    If I want to rewrite this controller JR_CreateAdminController_Adminhtml_CustomController by another controller, how can I achieve that.

  21. arjun says:

    That is my error please solve it or give me sugestion..

    Warning: simplexml_load_string(): Entity: line 10: parser error : Extra content at the end of the document in C:\xampp\htdocs\magento\lib\Varien\Simplexml\Config.php on line 510

    #0 [internal function]: mageCoreErrorHandler(2, ‘simplexml_load_…’, ‘C:\\xampp\\htdocs…’, 510, Array)
    #1 C:\xampp\htdocs\magento\lib\Varien\Simplexml\Config.php(510): simplexml_load_string(‘loadString(‘loadFile(‘C:\\xampp\\htdocs…’)
    #4 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Config.php(315): Mage_Core_Model_Config->_loadDeclaredModules()
    #5 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(414): Mage_Core_Model_Config->loadModules()
    #6 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(343): Mage_Core_Model_App->_initModules()
    #7 C:\xampp\htdocs\magento\app\Mage.php(684): Mage_Core_Model_App->run(Array)
    #8 C:\xampp\htdocs\magento\index.php(89): Mage::run(”, ‘store’)
    #9 {main}

  22. vipin kumar says:

    your module is working and i have installed it and tab created in admin section but i want to show table record when click on the tab so please help me how to create listing of the records. my magento version is

  23. Mukesh says:

    How, I can create admin view?

  24. Naveen says:

    I have done an basic extension setup with this tutorial, i have assigned a admin user group and gave permission to the module, but when i login with that user group i am getting error message like “Access denied
    Please try to logout and sign in again.
    If this message persists, please contact the store owner.” is there anything i have missed ? to give in the adminhtml controller?

  25. Purusottama says:

    Hi, Its work for me thanks.
    I want some list with minimum functionality. list pagination search etc.
    This only show blank page in admin site (body part empty) hope you get me.


  26. Gopal says:

    Nice one,
    I used this for Help Document in Magento but i cant give link to PDF (which is placed inside my server) or to give link to external server.

    How to do it. Please post them here.


  27. kumar harsh says:

    how to change image appearence of home page on Index Action click event
    please help me

  28. vijay says:

    please help this code is not working

  29. Julian Mancera says:

    TANK YOU VERY MUCH , i cant call different funtions of a controller, i didn know the sintax, it was a simply “_” after methot ,adminhtml/custom/list , for this I can call a different layout for each button whitout usign more tahn one controler and layout

  30. Alex says:

    Great Tutorial! Quick question, how do I change the url from “admin/custom/index”, to read “admin/foobar/index”
    Thanks again,

Leave a Reply

* Required fields