Magento:添加到管理菜单

时间:2015-09-14 06:57:29

标签: php magento

是否有关于如何创建新管理菜单项的好教程或示例?我设法创造了一个新项目,但现在我很难过。如何使用Magento的列表和编辑视图来显示和编辑数据?

1 个答案:

答案 0 :(得分:0)

任何模块的app / code / local / Namespace / Module / etc / config.xml文件负责管理菜单。以下代码片段在magento管理区域中为名为survey的模块添加自定义菜单选项: -

  <adminhtml>
<menu>
  <survey module="survey">
    <title>Survey</title>
    <sort_order>100</sort_order>
    <children>
      <surveybackend module="survey">
        <title>Stats</title>
        <sort_order>0</sort_order>
        <action>admin_survey/adminhtml_surveybackend</action>
      </surveybackend>
      <survey module="survey">
        <title>Manage Survey</title>
        <sort_order>0</sort_order>
        <action>admin_survey/adminhtml_survey</action>
      </survey>
      <question module="survey">
        <title>Manage Question</title>
        <sort_order>10</sort_order>
        <action>admin_survey/adminhtml_question</action>
      </question>
    </children>
  </survey>
</menu>
<acl>
  <resources>
    <all>
      <title>Allow Everything</title>
    </all>
    <admin>
      <children>
        <survey translate="title" module="survey">
          <title>Survey</title>
          <sort_order>1000</sort_order>
          <children>
      <surveybackend translate="title">
        <title>Stats</title>
      </surveybackend>
      <survey translate="title">
        <title>Manage Survey</title>
        <sort_order>0</sort_order>
      </survey>
      <question translate="title">
        <title>Manage Question</title>
        <sort_order>10</sort_order>
      </question>
          </children>
        </survey>
      </children>
    </admin>
  </resources>
</acl>
<layout>
  <updates>
    <survey>
      <file>survey.xml</file>
    </survey>
  </updates>
</layout>

以下是截图:

enter image description here

此外,最好引用一些简单的自定义扩展或magento模块,或者你可以在这里生成自己的模块: -

http://www.silksoftware.com/magento-module-creator/

随意点击并尝试各种选项。这里生成的模块可以更好地了解如何生成菜单并将其链接到其受尊重的页面,网格等。