Magento adminhtml子菜单无法正常工作

时间:2012-10-05 08:52:14

标签: magento submenu magento-1.7 adminhtml

这个问题让我们疯了,已经几个小时而且没有,我在尝试访问第二个子菜单时遇到404错误,关键字一个。我确定错误应该在控制器上或布局中,但我无法找到它。我发布了我的配置,控制器和布局文件。如果需要更多,也可以添加它,但我认为使用这些就足够了。我正在使用AlanStorm的CommerceBug,块和网格都正确加载。

以下是我的不同文件代码:

config.xml中

<?xml version="1.0"?>
<config>
    <modules>
        <Dts_Allpages>
            <version>0.1.0</version>
        </Dts_Allpages>
    </modules>
    <global>
        <models>
            <allpages>
                <class>Dts_Allpages_Model</class>
                <resourceModel>allpages_resource</resourceModel>
            </allpages>
            <allpages_resource>
                <class>Dts_Allpages_Model_Resource</class>
                <entities>
                    <referencedpages>
                        <table>referencedpages</table>
                    </referencedpages>
                    <keywords>
                        <table>keywords</table>
                    </keywords>
                </entities>
            </allpages_resource>
        </models>
        <events>
            <controller_action_predispatch>
                <observers>
                    <controller_action_before>
                        <class>allpages/observer</class>
                        <method>saveReferrer</method>
                    </controller_action_before>
                </observers>
            </controller_action_predispatch>
        </events>
        <helpers>
            <allpages>
                <class>Dts_Allpages_Helper</class>
            </allpages>
        </helpers>
        <resources>
            <allpages_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </allpages_write>
            <allpages_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </allpages_read>
        </resources>
        <blocks>
          <allpages>
            <class>Dts_Allpages_Block</class>
          </allpages>
        </blocks>
    </global>
    <admin>
        <routers>
            <allpages>
                <use>admin</use>
                    <args>
                        <module>Dts_Allpages</module>
                        <frontName>allpages</frontName>
                    </args>
            </allpages>
        </routers>
    </admin>
    <adminhtml>
        <menu>
          <allpagesmainmenu translate="title" module="allpages">
            <title>AllPages</title>
            <sort_order>100</sort_order>
            <children>
              <allpages module="allpages">
                <title>Keywords administration</title>
                <sort_order>0</sort_order>
                <children>
                    <references translate="title">
                        <title>References</title>
                        <sort_order>10</sort_order>
                        <action>allpages/adminhtml_allpagesbackend</action>
                    </references>
                    <keywords translate="title">
                        <title>Keywords</title>
                        <sort_order>20</sort_order>
                        <action>allpages/adminhtml_keywordsbackend</action>
                    </keywords>
                </children>
              </allpages>
            </children>
          </allpagesmainmenu>
        </menu>
        <acl>
          <resources>
            <admin>
              <children>
                <allpagesmainmenu translate="title" module="allpages">
                  <title>All Pages</title>
                  <children>
                    <allpages translate="title">
                        <title>Keywords administration</title>
                        <children>
                            <references translate="title">
                                <title>References</title>
                                <sort_order>10</sort_order>
                            </references>
                            <keywords translate="title">
                                <title>Keywords</title>
                                <sort_order>20</sort_order>
                            </keywords>
                        </children>
                    </allpages>
                  </children>
                </allpagesmainmenu>
              </children>
            </admin>
          </resources>
        </acl>
        <layout>
          <updates>
            <allpages>
              <file>allpages.xml</file>
            </allpages>
          </updates>
        </layout>
    </adminhtml>
</config>

KeywordsbackendController.php

<?php
class Dts_Allpages_Adminhtml_KeywordsbackendController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction()
    {
        $this->loadLayout();
        $this->_title($this->__("Administrador de keywords"));
        $this->renderLayout();
    }
}

布局 allpages.xml

<?xml version="1.0"?>
<layout version="0.1.0">
  <allpages_adminhtml_allpagesbackend_index>
      <reference name="content">
          <block type="allpages/adminhtml_allpagesbackend" name="allpagesbackend"/>
      </reference>
  </allpages_adminhtml_allpagesbackend_index>
  <allpages_adminhtml_allpagesbackend_edit>
      <reference name="content">
          <block type="allpages/adminhtml_allpagesbackend_edit" name="allpagesbackend_edit" />
      </reference>
  </allpages_adminhtml_allpagesbackend_edit>
  <allpages_adminhtml_keywordsbackend_index>
      <reference name="content">
          <block type="allpages/adminhtml_keywordsbackend" name="keywordsbackend"/>
      </reference>
  </allpages_adminhtml_keywordsbackend_index>
  <allpages_adminhtml_keywordsbackend_edit>
        <reference name="content">
            <block type="allpages/adminhtml_keywordsbackend_edit" name="keywordsbackend_edit" />
        </reference>
  </allpages_adminhtml_keywordsbackend_edit>
</layout>

1 个答案:

答案 0 :(得分:0)

一切都很好。问题在于文件的名称,因为我不知道控制器名称是如何 KeywordsbackendController.php .php ,当然,找不到该文件。但奇怪的是,我没有任何例外或类似情况。好吧,Magento模糊了内部,我已经习惯了。