404 error in Custom Magento configuration in admin

家住魔仙堡 提交于 2019-12-05 01:22:46

A 404 error in system configuration often means that there is an issue with ACL. You are likely missing the appropriate acl node in your module's adminhtml.xml file:

<acl>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <smsconfig> <!-- translate="title" module="sms_config" if appropriate and depending on config -->
                                    <title>Your Section</title>
</...>

After adding the above you will need to log out and log back in for full admin role users and explicitly add this role to custom admin user roles.

Do what @benmarks said plus be sure to add the right children (in your case) smsconfig

(@benmarks used sms_config instead of smsconfig)

<!-- namespace/modulename/etc/adminhtml.xml -->
<acl>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <smsconfig> <!-- translate="title" module="sms_config" if appropriate and depending on config -->
                                    <title>Your Section</title>
</...>

clear cache, admin logout, admin login == works

Hint: If you get 404 look at the url (when you clicked on your tab):

/index.php/admin/system_config/edit/section/mymodulename_something/...

This url seems to point to mymodulename_something:

<!-- namespace/modulename/etc/system.xml -->
<?xml version="1.0"?>
<config>
    <tabs>
        <mymodulename translate="label" module="mymodulename">
            <label>MyModuleName Awesome Label</label>
            <sort_order>1</sort_order>
        </mymodulename>
    </tabs>
    <sections>
        <mymodulename_something translate="label" module="mymodulename">
<!-- ... -->

so your adminhtml.xml would look like:

<!-- namespace/modulename/etc/adminhtml.xml -->
<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <mymodulename_something translate="title" module="mymodulename">
                                        <title>have no idea where this is showing up btw</title>
                                    </mymodulename_something>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

Don't underestimate the need to log out and then log back in after making ACL changes. Even if you clear your cache, you will still 404 until you log out and log back in.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!