2

I am working on a custom magento admin module, which can be configured through (System -> Configuration -> My Module). Here are my xml from etc dir:

app/code/community/Mycompany/Mymodule/etc/config.xml

<?xml version="1.0"?>
<config>

    <!-- Module Info -->
    <modules>
        <Mycompany_Mymodule>
            <version>2.0.0</version>
        </Mycompany_Mymodule>
    </modules>

    ...snipped...

</config>

app/code/community/Mycompany/Mymodule/etc/adminhtml.xml

<?xml version="1.0"?>
<config>

    <!-- Menu Setup -->
    <menu>
        <mycompany translate="title" module="mycompany_mymodule">
            <title>My Module</title>
            <sort_order>0</sort_order>
            <children>
                <configuration>
                    <title>Configuration</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/system_config/edit/section/mymodule_config</action>
                </configuration>
            </children>
        </mycompany>
    </menu>

    <!-- Access Control List -->
    <acl>
        <resources>
            <admin>
                <children>                
                    <mycompany translate="title" module="mycompany_mymodule">
                        <title>My Module</title>
                        <sort_order>1</sort_order>
                        <children>
                            <system>
                                <children>
                                    <config>
                                        <children>
                                            <mymodule_config>
                                                <title>Configuration</title>
                                            </mymodule_config>
                                        </children>
                                    </config>
                                </children>
                            </system>
                        </children>
                    </mycompany>
                </children>
            </admin>
        </resources>
    </acl>

</config>

app/code/community/Mycompany/Mymodule/etc/system.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <tabs>
        <mycompany translate="label" module="mycompany_mymodule">
            <label><![CDATA[
                <div style="position: absolute;">
                    <a style="background: none;" title="Click here to visit our website." href="http://www.my-site.com/" target="_blank">
                        <img id="mycompany_block" src="" alt="" border="0" />
                    </a>
                </div>&nbsp;
                <script>
                    var n = SKIN_URL.indexOf("adminhtml");
                    $('mycompany_block').src = SKIN_URL.substring(0, n) + "adminhtml/default/default/images/mysite/settings_logo.png";
                </script>
            ]]></label>
            <sort_order>100</sort_order>
        </mycompany>
    </tabs>
    <sections>
        <mymodule_config translate="label" module="mycompany_mymodule">
            <label>My Module</label>
            <tab>mycompany</tab>
            <sort_order>1000</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>0</show_in_website>
            <show_in_store>0</show_in_store>
            <groups>
                <system_config translate="label" module="mycompany_mymodule">
                    <label>System Configuration</label>
                    <sort_order>0</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>0</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>
                        <licence_key translate="label">
                            <label>Licence Key :</label>
                            <comment><![CDATA[Visit <a href="http://www.my-site.com">http://www.my-site.com</a> to obtain your licence key]]></comment>
                            <frontend_type>text</frontend_type>
                            <sort_order>0</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>0</show_in_website>
                            <show_in_store>0</show_in_store>
                        </licence_key>
                    </fields>
                </system_config>
            </groups>
        </mymodule_config>
    </sections>
</config>

After uploading the module, I can see the menu and when I click to go to the config, I see the following:

enter image description here

I tried going into (System -> Permission -> Users/Roles) and tried saving. Logging out and logging back again. Flushing cache etc... but no luck so far.

What have I done wrong here? I am using magento 1.9.x.

0

1 Answer 1

6

Okay, I figured it out (thanks to http://alanstorm.com/custom_magento_system_configuration).

Silly mistake on the ACL definition. This is the correct XML:

<acl>
    <resources>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <mymodule_config>
                                    <title>My Module Configuration</title>
                                </mymodule_config>
                            </children>
                        </config>
                    </children>
                </system>
            </children>
        </admin>
    </resources>
</acl>
1
  • You are invited to mark your own answer as solution :-) Jan 31, 2016 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.