Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How would I add a new menu item in the admin? 
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-09-03
Denver, CO
 

How would I add a new menu item in the admin?

I’ve put together some code that will tell me the wholesale value of all my stock and I’d like to access it from the Reports menu.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

<?xml version="1.0"?>
<config>
    <
adminhtml>
        <
menu>
            <
report>
                <
children>
                    <
mymodule translate="title" module="mymodule">
                        <
title>MyModule</title>
                        <
action>mymodule/adminhtml_mycontroller</action>
                        <
sort_order>-20</sort_order>
                    </
mymodule>
                </
children>
            </
report>
        </
menu>
    </
adminhtml>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Shpigford
Sr. Member
 
Avatar
Total Posts:  171
Joined:  2007-09-03
Denver, CO
 

Thanks Lee.

So what about the files with the actual PHP? Is there something I need to wrap them in to make them use the admin interface or anything?

And where would I put that XML?

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Well, you basically need a standard admin controller.  you can look at Mage_Adminhtml_controllers to see how Varien did it

That XML goes in your config.xml for your module

 
Magento Community Magento Community
Magento Community
Magento Community
 
annvinoth03
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2008-10-27
Chennai
 

Hi Lee

I have create new menu under catalog>store . But we have try to display the records same as an magento. But we have an error like this .

Can’t retrieve entity config: catalogstore/search_query
Trace:
#0 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Resource.php(135): Mage::throwException(’Can’t retrieve ...’)
#1 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(222): Mage_Core_Model_Resource->getTableName(’catalogstore/se...’)
#2 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(205): Mage_Core_Model_Mysql4_Abstract->getTable(’search_query’)
#3 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php(77): Mage_Core_Model_Mysql4_Abstract->getMainTable()
#4 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php(63): Mage_Core_Model_Mysql4_Collection_Abstract->_initSelect()
#5 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Config.php(715): Mage_Core_Model_Mysql4_Collection_Abstract->__construct(Object(Mage_CatalogStore_Model_Mysql4_Query))
#6 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Config.php(757): Mage_Core_Model_Config->getModelInstance(’catalogstore_my...’, Object(Mage_CatalogStore_Model_Mysql4_Query))
#7 /opt/lampp/htdocs/dev_compare/app/Mage.php(316): Mage_Core_Model_Config->getResourceModelInstance(’catalogstore/qu...’, Object(Mage_CatalogStore_Model_Mysql4_Query))
#8 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Abstract.php(185): Mage::getResourceModel(’catalogstore/qu...’, Object(Mage_CatalogStore_Model_Mysql4_Query))
#9 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Adminhtml/Block/Catalog/Store/Grid.php(44): Mage_Core_Model_Abstract->getResourceCollection()
#10 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(438): Mage_Adminhtml_Block_Catalog_Store_Grid->_prepareCollection()
#11 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(444): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
#12 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(635): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
#13 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(495): Mage_Core_Block_Abstract->toHtml()
#14 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(446): Mage_Core_Block_Abstract->_getChildHtml(’grid’, true)
#15 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(64): Mage_Core_Block_Abstract->getChildHtml(’grid’)
#16 /opt/lampp/htdocs/dev_compare/app/design/adminhtml/default/default/template/widget/grid/container.phtml(30): Mage_Adminhtml_Block_Widget_Grid_Container->getGridHtml()
#17 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Template.php(138): include(’/opt/lampp/htdo...’)
#18 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Template.php(170): Mage_Core_Block_Template->fetchView(’adminhtml/defau...’)
#19 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Template.php(187): Mage_Core_Block_Template->renderView()
#20 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(636): Mage_Core_Block_Template->_toHtml()
#21 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Text/List.php(37): Mage_Core_Block_Abstract->toHtml()
#22 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(636): Mage_Core_Block_Text_List->_toHtml()
#23 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(495): Mage_Core_Block_Abstract->toHtml()
#24 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(446): Mage_Core_Block_Abstract->_getChildHtml(’content’, true)
#25 /opt/lampp/htdocs/dev_compare/app/design/adminhtml/default/default/template/page.phtml(67): Mage_Core_Block_Abstract->getChildHtml(’content’)
#26 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Template.php(138): include(’/opt/lampp/htdo...’)
#27 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Template.php(170): Mage_Core_Block_Template->fetchView(’adminhtml/defau...’)
#28 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Template.php(187): Mage_Core_Block_Template->renderView()
#29 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Block/Abstract.php(636): Mage_Core_Block_Template->_toHtml()
#30 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Model/Layout.php(509): Mage_Core_Block_Abstract->toHtml()
#31 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Controller/Varien/Action.php(320): Mage_Core_Model_Layout->getOutput()
#32 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Adminhtml/controllers/Catalog/StoreController.php(38): Mage_Core_Controller_Varien_Action->renderLayout()
#33 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Controller/Varien/Action.php(343): Mage_Adminhtml_Catalog_StoreController->indexAction()
#34 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php(137): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#35 /opt/lampp/htdocs/dev_compare/app/code/core/Mage/Core/Controller/Varien/Front.php(168): Mage_Core_Controller_Varien_Router_Admin->match(Object(Mage_Core_Controller_Request_Http))
#36 /opt/lampp/htdocs/dev_compare/app/Mage.php(421): Mage_Core_Controller_Varien_Front->dispatch()
#37 /opt/lampp/htdocs/dev_compare/index.php(131): Mage::run()
#38 {main}

Please help to me . This is my email id -

 
Magento Community Magento Community
Magento Community
Magento Community
 
Netismine
Sr. Member
 
Avatar
Total Posts:  174
Joined:  2008-10-28
 

Hi,

I’m trying to build the addition to the admin. I’ve added code to xml, and my menu item now shows. But I get 404. I’ve made the controller , but what I don’t get is what calls that controller? So how do I direct Magento to that controller? What happens when I click on menu item? It goes to admin router.php, but what happens next?
How do I point magento to my menu item controller?

 
Magento Community Magento Community
Magento Community
Magento Community
 
aruss
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2008-12-26
Germany
 

HI i have a problem to add a menu Items of my modules as a submenu of a customer modul, I have 2 modules and if i activate one of them it works well but if i activate both i see just a last one

my config files are as follows

for a first module

<menu>
    <
customer>
        <
children>
            <
items translate="title" module="module1">
                <
title>Manage Module1 Items</title>
                <
sort_order>100</sort_order>
                <
action>module1/manage_module1</action>
            </
items>
        </
children>
    </
customer>
</
menu>

and for a second

<menu>
    <
customer>
        <
children>
            <
items translate="title" module="module2">
                <
title>Manage Module2 Items</title>
                <
sort_order>200</sort_order>
                <
action>module2/manage_module2</action>
            </
items>
        </
children>
    </
customer>
</
menu>

this are independent modules I created a first module with a mogento module creator, then I copied a first modul and run over all files and replaced a name.

could somebody help me out, please

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top