2015-04-27 79 views
1

我有一個自定義模塊。我希望它出現在權限部分。我將config.xml文件中的菜單定義爲 -自定義模塊的magento菜單不工作

<config> 
    <modules> 
     <Inventory_Uploads> 
      <version>1.4.0</version> 
     </Inventory_Uploads> 
    </modules> 
    <frontend> 
     <routers> 
      <uploads> 
       <use>standard</use> 
       <args> 
        <module>Inventory_Uploads</module> 
        <frontName>uploads</frontName> 
       </args> 
      </uploads> 
     </routers> 
     <layout> 
      <updates> 
       <uploads> 
        <file>uploads.xml</file> 
       </uploads> 
      </updates> 
     </layout> 
    </frontend> 
    <admin> 
     <routers> 
      <uploads> 
       <use>admin</use> 
       <args> 
        <module>Inventory_Uploads</module> 
        <frontName>uploads</frontName> 
       </args> 
      </uploads> 
     </routers> 
    </admin> 
    <adminhtml> 
     <menu> 
      <uploads module="uploads"> 
       <title>Band Config</title> 
       <sort_order>71</sort_order> 
       <children> 
        <sub_menu1 translate="title"> 
         <title>Config Menu</title> 
         <sort_order>10</sort_order> 
         <action>uploads/adminhtml_uploads</action> 
        </sub_menu1> 
       </children> 
      </uploads> 
     </menu> 
     <acl> 
      <resources> 
       <admin> 
        <children> 
         <uploads translate="title" module="uploads"> 
          <title>Band Config</title> 
          <sort_order>71</sort_order> 
          <action>uploads/adminhtml_uploads</action> 
          <children> 
           <items module="uploads"> 
            <title>Config Menu</title> 
            <sort_order>10</sort_order> 
            <action>uploads/adminhtml_uploads</action> 
           </items> 
          </children> 
         </uploads> 
        </children> 
       </admin> 
      </resources> 
     </acl> 


     <layout> 
      <updates> 
       <uploads> 
        <file>uploads.xml</file> 
       </uploads> 
      </updates> 
     </layout> 
    </adminhtml> 
    <global> 
     <models> 
      <uploads> 
       <class>Inventory_Uploads_Model</class> 
       <resourceModel>uploads_mysql4</resourceModel> 
      </uploads> 
      <uploads_mysql4> 
       <class>Inventory_Uploads_Model_Mysql4</class> 
       <entities> 
        <order><table>admin_user</table></order> 
       </entities> 
      </uploads_mysql4> 
     </models> 
     <resources> 
      <uploads_setup> 
       <setup> 
        <module>Inventory_Uploads</module> 
        <class>Mage_Sales_Model_Mysql4_Setup</class> 
       </setup> 
       <connection> 
        <use>core_setup</use> 
       </connection> 
      </uploads_setup> 
      <uploads_write> 
       <connection> 
        <use>core_write</use> 
       </connection> 
      </uploads_write> 
      <uploads_read> 
       <connection> 
        <use>core_read</use> 
       </connection> 
      </uploads_read> 
     </resources> 
     <blocks> 
      <uploads> 
       <class>Inventory_Uploads_Block</class> 
      </uploads> 
     </blocks> 
     <helpers> 
      <uploads> 
       <class>Inventory_Uploads_Helper</class> 
      </uploads> 
     </helpers> 
    </global> 
</config> 

它出現在權限部分。當我選擇並保存時,它們會被正確保存。但是,當我將該角色分配給任何用戶並登錄時,則子菜單不會顯示在那裏。它只顯示「帶配置」菜單,但不顯示它的子菜單「配置菜單」。在XML中有任何標籤錯誤?

任何幫助表示讚賞。

謝謝。

回答

2

部分中兒童的名稱必須與您的部分sub_menu1中定義的名稱相同。

嘗試使用這種配置:

<acl> 
      <resources> 
       <admin> 
        <children> 
         <uploads translate="title" module="uploads"> 
          <title>Band Config</title> 
          <sort_order>71</sort_order> 
          <action>uploads/adminhtml_uploads</action> 
          <children> 
           <sub_menu1 module="uploads"> 
            <title>Config Menu</title> 
            <sort_order>10</sort_order> 
            <action>uploads/adminhtml_uploads</action> 
           </sub_menu1> 
          </children> 
         </uploads> 
        </children> 
       </admin> 
      </resources> 
     </acl>