Magento How to create Menu Point


We will find how to add a link to Magento Admin Menu, which shown on the left site of Admin Menu pages of Magento 2 and on the top page in Magento 1 Admin.



Step 1: Configuration Files


Magento 1


File path: app/code/local/MageCheck/MenuPoint/etc/config.xml

<?xml version='1.0'?> <config> <modules> <MageCheck_MenuPoint> <version>1.0.0</version> </MageCheck_MenuPoint> </modules> <global> <helpers> <magecheck_menupoint> <class>Mage_Core_Helper</class> </magecheck_menupoint> </helpers> </global> <admin> <routers> <adminhtml> <args> <modules> <menupoint before='Mage_Adminhtml'>MageCheck_MenuPoint_Adminhtml</menupoint> </modules> </args> </adminhtml> </routers> </admin> </config>

Magento 2


File path: app/code/MageCheck/Tutorial/etc/module.xml

<?xml version='1.0'?> <config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='urn:magento:framework:Module/etc/module.xsd'> <module name='MageCheck_Tutorial' setup_version='1.0.2'/> </config>

Step 2: Create Admin Menu Files


Magento 1


File path: app/code/local/MageCheck/MenuPoint/etc/adminhtml.xml

<?xml version='1.0' encoding='UTF-8'?> <config> <menu> <mycustomtabs module='magecheck_menupoint' translate='title'> <title>MageCheck</title> <sort_order>100</sort_order> <children> <index module='magecheck_menupoint' translate='title'> <title>Tutorial 1</title> <sort_order>1</sort_order> <action>adminhtml/custom</action> </index> <list module='magecheck_menupoint' translate='title'> <title>Tutorial 2</title> <sort_order>2</sort_order> <action>adminhtml/custom/list</action> </list> </children> </mycustomtabs> </menu> <acl> <resources> <admin> <children> <mycustomtabs translate='title' module='magecheck_menupoint'> <title>My Controller</title> <sort_order>-100</sort_order> <children> <index translate='title'> <title>Index Action</title> <sort_order>1</sort_order> </index> <list translate='title'> <title>List Action</title> <sort_order>2</sort_order> </list> </children> </mycustomtabs> </children> </admin> </resources> </acl> </config>

Magento 2


File path: app/code/MageCheck/Tutorial/etc/adminhtml/menu.xml

<?xml version='1.0'?> <config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='urn:magento:module:Magento_Backend:etc/menu.xsd'> <menu> <add id='MageCheck_Tutorial::helloworld' title='MageCheck' module='MageCheck_Tutorial' sortOrder='51' resource='MageCheck_Tutorial::helloworld'/> <add id='MageCheck_Tutorial::post' title='Tutorials' module='MageCheck_Tutorial' sortOrder='10' action='magecheck_tutorial/post' resource='MageCheck_Tutorial::post' parent='MageCheck_Tutorial::helloworld'/> <add id='MageCheck_Tutorial::hello_configuration' title='Configuration' module='MageCheck_Tutorial' sortOrder='99' parent='MageCheck_Tutorial::helloworld' action='adminhtml/system_config/edit/section/helloworld' resource='MageCheck_Tutorial::helloworld_configuration'/> </menu> </config>


Step 3: Create Function and Test it


Magento 1


File path: app/code/local/MageCheck/MenuPoint/controllers/ Adminhtml/MenuPoint.php

<?php class MageCheck_MenuPoint_Adminhtml_MenuPoint extends Mage_Adminhtml_Controller_Action { public function indexAction() { $this->loadLayout() ->_setActiveMenu('mycustomtabs') ->_title($this->__('Index Action')); // ... $this->renderLayout(); } public function listAction() { $this->loadLayout() ->_setActiveMenu('mycustomtabs') ->_title($this->__('List Action')); // ... $this->renderLayout(); } }

Magento 2


In order to see the Menu Point you just created, you have tu flush cache and log In to Magento 2 Admin.

php bin/magento cache:clean

php bin/magento cache:flush

Now you should have the menu point on the left sife of the page with two option. This is a simple tutorial, but also you cand add your functions for that two options in this module.

If you want to change the icon, you can create a css file with the content of a new icon.


And now you should have your new Admin Menu Point!