简体   繁体   中英

Magento Custom Module: How to Create Admin menu

Finder
Setting

what should be the url to go to system/configuration of our custom module from admin menu setting.

<menu>
 <finder module="finder">
  <title>finder</title>
    <sort_order>71</sort_order>               
      <children>
    <items module="finder">
    <title>Manage Finder</title>
    <sort_order>0</sort_order>
    <action>finder/adminhtml_finder</action>
   </items>
       <items module="finder">
    <title>Setting</title>
    <sort_order>0</sort_order>
    <action> ????  </action>
</items>
  </children>
    </finder>
    </menu>

Jack you can give action like follow :

<action>adminhtml/system_config/edit/section/your menu item</action>

http://inchoo.net/ecommerce/magento/create-configuration-for-your-magento-extension/ this one is one of the good example.

you can take as below to add in catalog of system configuration. and you have to create system.xml

<?xml version="1.0"?>
<config>
    <tabs>
        <helloconfig translate="label" module="todaydeal">
            <label>Today Deal</label>
            <sort_order>99999</sort_order>
        </helloconfig>
    </tabs> 
   <sections>
        <catalog>
            <groups>
                <todaydeal translate="label" module="todaydeal">
                    <label>Daily Deal</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1000</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>

                    <fields>
                        <active translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </active>                        
                    </fields>
                </todaydeal>
            </groups>
        </catalog>
    </sections>
</config>

you can also refer Detail Document LINK , i am sure i will very helpful to you.

let me know if i can help you further

You can use following code create admin side menu and also have action to do system/configuration.Add following code in app/code/local/[Name_Space]/[Module_Name]/etc/config.xml

      <adminhtml>
         <menu>
            <news module="news">
                <title>News</title>
                <sort_order>71</sort_order>               
                <children>
                    <items module="news">
                        <title>Manage Items</title>
                        <sort_order>0</sort_order>
                        <action>news/adminhtml_news</action>
                    </items>
                    <items1 module="news">
                        <title>Import News Data</title>
                        <sort_order>1</sort_order>
                        <action>adminhtml/system_config/edit/section/news</action>
                    </items1>
                </children>
            </news>
        </menu>
  </adminhtml>  

Note that here news will be the same as section name in system.xml file.

Hi Add following code instead of <itmes> .

 <config module="finder">
                        <title>Configurations</title>
                        <sort_order>10</sort_order>
                        <action>adminhtml/system_config/edit/section/finder</action>
                    </config>

              Write down ACL code after the </menu> ending tag.  Your code will be like this 

              <acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <My_module>
                    <title>My finder Module</title>
                    <sort_order>10</sort_order>
                </My_module>
                <system>
                    <children>
                    <config>
                        <children>
                        <finder>
                            <title>finder Module Section</title>
                        </finder>
                        </children>
                    </config>
                    </children>
                </system>
            </children>
        </admin>
    </resources>
</acl>

You can refer to the link below to create admin menu in Magento2: https://github.com/jainmegha5395/admin-menu

Explanation:

You need to create menu.xml file inside \\etc\\adminhtml\\ of your module.

Add below code inside <menu> tag.

  <add id="Custom_Module::custom" title="CUSTOM" translate="title" module="Custom_Module" sortOrder="90" dependsOnModule="Custom_Module" resource="Custom_Module::custom"/>

  <add id="Custom_Module::news" title="News" translate="title" module="Custom_Module" parent="Custom_Module::custom" sortOrder="50" dependsOnModule="Custom_Module" resource="Custom_Module::news"/>

This code will create a menu named as NEWS which comes under heading CUSTOM .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM