Skip to content

Instantly share code, notes, and snippets.



Last active Apr 1, 2019
What would you like to do?
Dynamically add items to admin menu in Magento
<?xml version="1.0"?>
<MENU_ITEMS_CONTAINER translate="title" module="module">
<title>Menu Items Container title</title>
<!-- Children are added dynamically -->
class My_Module_Model_Observer {
* Update admin menu with dynamic items
public function updateAdminMenu()
$menu = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu/MAIN_MENU_ITEM/children/MENU_ITEMS_CONTAINER/children');
// Repeat numbered steps below as many times as you want to add items to the admin menu
// 1. Create $xml which is a valid admin menu item definition
$xml = '<dynamic_item><title>Dynamic Item</title><sort_order>10</sort_order><action>adminhtml/some/route</action></dynamic_item>';
// 2. Make a config node with $xml content
$node = new Mage_Core_Model_Config_Element($xml);
// 3. Append $node to existing loaded menu node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.