3/19/2011

How to adding new menu in magento admin panel

Here I have Created a new Module to Add new tab in admin panel of magento.
My Namesapce Name is Anjan and My Module name is Systab
As you know to make a module first we need to make a .XML file with Namespace_Module name under app/etc/modules/ folder. So My File name will be Anjan_Systab.xml

Now I will write the following code inside this xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Anjan_Systab>
            <active>true</active>
            <codePool>local</codePool>
        </Anjan_Systab>
    </modules>
</config>

As My CodePool is local which is written in Anjan_Systab.xml I will create a Folder with name Anjan inside app/code/local/, then again will create another folder with name Systab inside Anjan Folder.Now I will create an etc folder inside the Systab Folder. Inside the etc folder I will create config.xml and will write the following code

<?xml version="1.0"?>
<config>
    <modules>
        <Anjan_Systab>
            <version>0.1.0</version>
        </Anjan_Systab>
    </modules>
    <frontend>
        <routers>
            <systab>
                <use>standard</use>
                <args>
                    <module>Anjan_Systab</module>
                    <frontName>systab</frontName>
                </args>
            </systab>                        
        </routers>
        <layout>
            <updates>
                <systab>
                    <file>systab.xml</file>
                </systab>
            </updates>
        </layout>
    </frontend>
    <admin>
        <routers>
            <systab>
                <use>admin</use>
                <args>
                    <module>Anjan_Systab</module>
                    <frontName>systab</frontName>
                </args>
            </systab>
        </routers>
    </admin>
    <adminhtml>
        <menu>
            <systab module="systab">
                <title>My Tab</title>
                <sort_order>71</sort_order>
                <children>
                    <items module="systab">
                        <title>Manage Profile</title>
                        <sort_order>0</sort_order>
                        <action>systab/adminhtml_systab</action>
                    </items>
                </children>
            </systab>
        </menu>
        <acl>
            <resources>
                <all>
                    <title>Allow Everything</title>
                </all>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <systab>
                                            <title>System Configuration Tab</title>
                                        </systab>
                                    </children>
                                </config>
                            </children>
                        </system>
                        <Anjan_Systab>
                            <title>System Configuration Tab</title>
                            <sort_order>10</sort_order>
                        </Anjan_Systab>
                    </children>
                </admin>
            </resources>
        </acl>
        <layout>
            <updates>
                <systab>
                    <file>systab.xml</file>
                </systab>
            </updates>
        </layout>
    </adminhtml>
    <global>
        <models>
            <systab>
                <class>Anjan_Systab_Model</class>
                <resourceModel>systab_mysql4</resourceModel>
            </systab>
            <systab_mysql4>
                <class>Anjan_Systab_Model_Mysql4</class>
                <entities>
                    <systab>
                        <table>systab</table>
                    </systab>
                </entities>
            </systab_mysql4>
        </models>
        <resources>
            <systab_setup>
                <setup>
                    <module>Anjan_Systab</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </systab_setup>
            <systab_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </systab_write>
            <systab_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </systab_read>
        </resources>
        <blocks>
            <systab>
                <class>Anjan_Systab_Block</class>
            </systab>
        </blocks>
        <helpers>
            <systab>
                <class>Anjan_Systab_Helper</class>
            </systab>
        </helpers>
    </global>
</config>

Now Clear your magento cache and login to you admin panel You can see one Tab Named My Tab has been successfully created.

10 comments:

  1. I DID IT...bt its showing 404 error when i click on that...i want to view a blank page when i click on d menu item...how should i do that...???

    ReplyDelete
    Replies
    1. may be you did not changed the action here
      systab/adminhtml_systab

      And also do not forgot to refresh Magento Cache.

      Delete
    2. what does 'systab' in systab/adminhtml_'systab' stand for?

      Delete
    3. systab is module name.. you can write anything instead of that

      Delete
  2. I have to delete order in admin panel sales/order . I have used EM_DeleteOrders Extension install and orders are also deleted but sales /order Format can be changed so what is the reason behind that.Please suggest any idea about this.wait you positive reply.

    ReplyDelete
    Replies
    1. sales /order Format.. what does it mean ?
      Are you talking about increment Id ?

      Delete
  3. its showing a 404 error even the action give

    ReplyDelete
  4. Anonymous6/25/2013

    Warning: include(Arjan/Systab/Helper/Data.php): failed to open stream: No such file or directory in

    ReplyDelete
    Replies
    1. Create Anjan_Systab_Helper_Data class

      Delete