【问题标题】:Magento system.xml and 404 error when trying to access the configuration panel尝试访问配置面板时出现 Magento system.xml 和 404 错误
【发布时间】:2011-09-19 08:31:51
【问题描述】:

我正在尝试为我的自定义模块实现一些配置设置。我设法在左侧导航栏中添加了一个选项卡和一个部分。但是当我想打开一个部分时,我得到一个 404 错误页面,没有任何进一步的信息。

到目前为止,我已经尝试了任何方法来使其正常工作.. 阅读博客、示例等,但我找不到错误。也许你们中的某个人可以解释我做错了什么。

我的adminhtml.xml

<?xml version="1.0" ?>
<config>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <tempest_section translate="title" module="Tempest">
                                    <title>Tempest</title>
                                </tempest_section>
                            </children>
                        </config>
                    </children>
                </system>
            </children>
        </admin>
    </resources>
</config>

我的config.xml

<?xml version="1.0"?>

<config>
    <modules>
        <Polyvision_Tempest>
            <version>0.1.0</version>
        </Polyvision_Tempest>
    </modules>


    <global>
        <helpers>
            <Tempest>
                <class>Polyvision_Tempest_Helper</class>
            </Tempest>  
        </helpers>
    </global>        

    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <tempest before="Mage_Adminhtml">Polyvision_Tempest_Adminhtml</tempest>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>


    <adminhtml>
        <menu>
            <menu1 translate="title" module="Tempest">
                <title>polyvision</title>
                <sort_order>60</sort_order>
                <children>
                    <menuitem1 module="Tempest">
                        <title>Tempest - Export</title>
                        <action>adminhtml/tempest_main</action>
                    </menuitem1>
                </children>                
            </menu1>
        </menu>
    </adminhtml>    

    <default>
        <tempest>
            <settings>
                <export_directory>/tmp/</export_directory>
            </settings>
        </tempest>
    </default>
</config>

我的system.xml

<?xml version="1.0" ?>
<config>
    <tabs>
        <polyvision module="Tempest" translate="label">
            <label>polyvision</label>
            <sort_order>100</sort_order>
        </polyvision>
    </tabs>
    <sections>
        <tempest_section module="Tempest" translate="label">
            <label>Tempest-Einstellungen</label>
            <sort_order>200</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <tab>polyvision</tab>
            <groups>
                <settings translate="label">
                    <label>Settings</label>
                    <comment></comment>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <export_directory translate="label tooltip comment">
                            <label>My Custom Field</label>
                            <comment>Some comment about my field</comment>
                            <tooltip>Field ToolTip</tooltip>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        <frontend_input>text</frontend_input>
                        <source_model>adminhtml/system_config_text</source_model>
                    </export_directory>
                </fields>
            </settings>
        </groups>
    </tempest_section>
</sections>

嗯,我的模块本身可以轻松运行。只有管​​理员设置不起作用:/

【问题讨论】:

    标签: magento configuration system http-status-code-404


    【解决方案1】:

    如果是 Admin Console chrome 中的 404,那么您的问题是缺少 ACL 角色。阅读this article on how to set one up。 (自链接)

    此外,在设置 ACL 角色后,您需要清除 Magento 会话。 Magento 缓存会话中的特定角色,新会话不会自动添加到具有超级用户角色的用户的缓存中。

    【讨论】:

    • 谢谢!这个网站上的例子比我在我的书和博客等上找到的所有其他东西都更清楚。
    • 谢谢艾伦。 /rantmode 这真是令人难以置信,你必须清除会话,而这没有写在任何地方。由于这个简单的原因,我昨天敲了大约五个小时的头。更糟糕的是,如果我不小心退出了它会起作用,我不知道为什么... /endrantmode 回到通常的 Magento 问题 :)
    • 我不必创建 ACL 角色,但我只创建了 rm -fr var/cache/* var/session/* 并且它有效。 Magento...
    • @Alan 查看系统配置管理控制器,看看缺少哪些信息导致 Magento 抛出导致 404 页面的异常。
    • 看来我上传的代码有错字!基本上,我在config.xml 中为admin/system/config/helloworld_options 设置了ACL,但还定义了helloworld_option 部分。更正该错误后,我现在看到了已定义的配置部分。
    【解决方案2】:

    您好,我认为 config.xml 中的操作标记有问题。

    <action>adminhtml/tempest_main</action>
    

    如果我没记错的话,这里指的是 app/code/core/Mage/Adminhtml 中的 adminhtml 模块。

    您的模块名称是什么,您的控制器文件夹中有什么。

    我认为操作的第一位应该是您的控制器的名称,然后是您的管理控制器和操作的路径

    动作标签的构建方式如下。

    <action>matrixrate/adminhtml_index/index</action>
           |--module--|--controller---|-action-|
    

    HTH

    【讨论】:

    • 好吧,对不起,但这似乎不是错误。如果我更改此操作标签,那么我将无法打开该模块。目前使用该模块没有问题,只有System/Configuration不起作用然后我在配置面板中打开polyvision-TAB。
    【解决方案3】:

    在您的 config.xml 中授予 acl 权限。

    <adminhtml>
            <acl>
                <resources>
                    <all>
                        <title>Allow Everything</title>
                    </all>
                    <admin>
                        <children>
                            <system>
                                <children>
                                    <config>
                                        <children>
                                            <tab_name>
                                                <title>Module - All</title>
                                            </tab_name>
                                        </children>
                                    </config>
                                </children>
                            </system>
                        </children>
                    </admin>
                </resources>
            </acl>
        </adminhtml>
    

    刷新缓存,注销并再次登录。

    【讨论】:

      猜你喜欢
      • 2014-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-29
      • 1970-01-01
      • 1970-01-01
      • 2016-10-06
      • 1970-01-01
      相关资源
      最近更新 更多