Magento

How to add admin panel Custom Menu in Magento?

Edit post in magento

Added a new tab in the admin panel take a look at the picture

custom1

Folder  structure:-

folder

Here is what i have in my files:-

1) IN — app/etc/modules/Shraddha_CreateAdminController.xml

[php]
<?xml version=”1.0″?>

<config>

<modules>

<Shraddha_CreateAdminController>

<active>true</active>

<codePool>community</codePool>

</Shraddha_CreateAdminController>

</modules>
</config>
[/php]

2)  IN– app/code/community/Shraddha/CreateAdminController/etc/config.xml

[php]
<?xml version=”1.0″?>

<config>

<modules>

<Shraddha_CreateAdminController>

<version>1.0.0</version>

</Shraddha_CreateAdminController>

</modules>

<global>

<helpers>

<shraddha_createadmincontroller>

<!– Helper definition needed by Magento –>

<class>Mage_Core_Helper</class>

</shraddha_createadmincontroller>

</helpers>

</global>

<admin>

<routers>

<adminhtml>

<args>

<modules>

<foo_bar before=”Mage_Adminhtml”>Shraddha_CreateAdminController_Adminhtml</foo_bar>

</modules>

</args>

</adminhtml>

</routers>

</admin>

</config>
[/php]

3)  IN-app/code/community/Shraddha/CreateAdminController/etc/adminhtml.xml

[php]
<?xml version=”1.0″ encoding=”UTF-8″?>

<config>

<menu>

<mycustomtab module=”shraddha_createadmincontroller” translate=”title”>

<title>My Custom Tab</title>

<sort_order>100</sort_order>

<children>

<index module=”shraddha_createadmincontroller” translate=”title”>

<title>Index Action</title>

<sort_order>1</sort_order>

<children>

<index translate=”title”>

<title>Index</title>

<sort_order>1</sort_order>

</index>

<list module=”shraddha_createadmincontroller” translate=”title”>

<title>List </title>

<sort_order>2</sort_order>

<action>adminhtml/custom/List</action>

</list>

</children>

<action>adminhtml/custom</action>

</index>

<list module=”shraddha_createadmincontroller” translate=”title”>

<title>List Action</title>

<sort_order>2</sort_order>

<action>adminhtml/custom/list</action>

</list>

</children>

</mycustomtab>

</menu>

<acl>

<resources>

<admin>

<children>

<custom translate=”title” module=”shraddha_createadmincontroller”>

<title>My Controller</title>

<sort_order>-100</sort_order>

<children>

<index translate=”title”>

<title>Index Action</title>

<sort_order>1</sort_order>

</index>

<children>

<index translate=”title”>

<title>Index Action</title>

<sort_order>1</sort_order>

</index>

</children>

</children>

<children>

<list translate=”title”>

<title>List Action</title>

<sort_order>2</sort_order>

</list>

</children>

</custom>

</children>

</admin>

</resources>

</acl>

</config>
[/php]

4) IN– app/code/community/Shraddha/CreateAdminController/controllers/Adminhtml/CustomController.php

[php]
<?php
class Shraddha_CreateAdminController_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action

{

public function indexAction()

{

$this->loadLayout()

->_setActiveMenu(‘mycustomtab’)

->_title($this->__(‘Index Action’));

$this->renderLayout();

}
public function listAction()

{

$this->loadLayout()

->_setActiveMenu(‘mycustomtab’)

->_title($this->__(‘List Action’));

$this->renderLayout();

}

protected function _isAllowed()

{

return Mage::getSingleton(‘admin/session’)->isAllowed(‘Shraddha_CreateAdminController/’);

}

}
[/php]