簡體   English   中英

Magento自定義模塊:如何創建管理菜單

[英]Magento Custom Module: How to Create Admin menu

Finder
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>

傑克,您可以采取以下行動:

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

http://inchoo.net/ecommerce/magento/create-configuration-for-your-magento-extension/這是一個很好的例子。

您可以按照以下方法添加系統配置目錄。 並且您必須創建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>

您也可以參考詳細文檔LINK ,我相信我會對您有很大幫助。

讓我知道我能否進一步幫助您

您可以使用以下代碼創建管理員側菜單,也可以執行系統/配置操作。在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>  

請注意,這里的新聞將與system.xml文件中的部分名稱相同。

嗨,添加以下代碼而不是<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>

您可以參考下面的鏈接在Magento2中創建管理菜單: https : //github.com/jainmegha5395/admin-menu

說明:

您需要在模塊的\\ etc \\ adminhtml \\內部創建menu.xml文件。

<menu>標記內添加以下代碼。

  <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"/>

此代碼將創建一個名為NEWS的菜單,其標題為CUSTOM

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM