404 error in Custom Magento configuration in admin
Asked Answered
S

3

10

I'm developing a custom SMS module in Magento 1.6.

I've setup the system.xml file to manage the related custom configuration fields.

The menu entry shows up, but when I click it, a 404 error page is shown instead of the expected configuration fields list.

Can you see any errors in my code?

<config>
<tabs>
    <mynew_tab translate="label">
        <label>SMS Gateway Integration</label>
        <sort_order>100</sort_order>
    </mynew_tab>
</tabs>
<sections>
    <smsconfig  translate="label">
        <label>SMS Gateway Integration</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>mynew_tab</tab>
        <groups>
            <sms_group translate="label">
                <label>My Custom Configurations</label>
                <comment>This is example of custom configuration.</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>
                    <sms_enabled translate="label tooltip comment">
                        <label>Is Enabled</label>
                        <frontend_type>select</frontend_type>
                        <source_model>adminhtml/system_config_source_yesno</source_model>
                        <sort_order>0</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Enable this module.</comment>
                    </sms_enabled>
                    <sms_username translate="label tooltip comment">
                        <label>Sender Email</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Username of the SMS gateway.</comment>
                    </sms_username>
                    <sms_password translate="label tooltip comment">
                        <label>Sender Email</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>1</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <comment>Password of the SMS gateway.</comment>
                    </sms_password>
                </fields>
            </sms_group>
        </groups>
    </smsconfig>
</sections>

After ben's request, we placed the adminhtml.xml file. I placed the content of the XML file.

<config>
<acl>   
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <sms translate="title" module="sms">
                                    <title>SMS Gateway Section</title>
                                </sms>
                            </children>
                        </config>
                    </children>
                </system>
           </children>
       </admin>
   </resources>
</acl>

But till the 404 error comes...

Segarra answered 6/12, 2011 at 10:18 Comment(2)
To find the exact error: This Worked for me pradhab.blogspot.com/2013/03/magento-404-error.html Try thisFoah
Please don't supply "link only" answers (what will happen if the page on the remote site is taken down?). If the external content is relevant, add the steps / code to your answer and you can cite the source as an extra note.Leventis
C
35

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.

Catina answered 6/12, 2011 at 17:47 Comment(6)
I placed the adminhtml.xml file and follow your instruction. But till it though 404 error.Segarra
You are correct Ben, I have some bugs in my code. Now it was working. Thanks for your help.Segarra
You have to disconnect to take effect.Princely
<sms_config> should be <smsconfig>, same as the name used in system.xml under sectionsCecilia
Indeed it should. Edited.Catina
Had same problem. Configuration was OK, just forgot to log out and log back. Thanks for mentioning itUltimogeniture
F
3

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>
Feckless answered 16/10, 2015 at 14:2 Comment(0)
R
2

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.

Ranna answered 6/7, 2015 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.