3

I need to create menu in the magento admin panel. I am not able to create menu in my admin panel. Here below is my xml code. The following code contains the adminhtml part using which I need to create the menu. Please provide possible reasons for it is not working.

<adminhtml>
<acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <pincode translate="title" module="pincode">
                    <title>Pincode</title>
                    <sort_order>1000</sort_order>
                    <children>
                        <pincodebackend translate="title">
                            <title>Pincode Import</title>
                        </pincodebackend>
                        <pincode translate="title">
                            <title>Manage Pincode</title>
                            <sort_order>0</sort_order>
                        </pincode>
                    </children>
                </pincode>
            </children>
        </admin>
    </resources>
</acl>
<layout>
    <updates>
        <pincode>
            <file>pincode.xml</file>
        </pincode>
    </updates>
</layout>
</adminhtml>

2 Answers 2

1

Your code is only declaring the ACL for the menu but not the menu itself.

Please add the following code right after the <adminhtml> tag:

<menu>
        <pincode translate="title" module="pincode">
            <title>Pincode</title>
            <sort_order>1000</sort_order>
            <children>
                <pincodebackend translate="title">
                    <title>Pincode Import</title>
                </pincodebackend>
                <pincode translate="title">
                    <title>Manage Pincode</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/namespace_module/action</action>
                </pincode>
            </children>
        </pincode>
</menu>
1
0

You need to add <menu> before <acl> like below :

<adminhtml>
<acl>
    <menu>
        <children>
            <pincode translate="title" module="pincode">
                <title>Pincode</title>
                <sort_order>1000</sort_order>
                <children>
                    <pincodebackend translate="title">
                        <title>Pincode Import</title>
                    </pincodebackend>
                    <pincode translate="title">
                        <title>Manage Pincode</title>
                        <sort_order>0</sort_order>
                        <action>adminhtml/namespace_module/action</action>
                    </pincode>
                </children>
            </pincode>
        </children>
    </menu>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <pincode translate="title" module="pincode">
                    <title>Pincode</title>
                    <sort_order>1000</sort_order>
                    <children>
                        <pincodebackend translate="title">
                            <title>Pincode Import</title>
                        </pincodebackend>
                        <pincode translate="title">
                            <title>Manage Pincode</title>
                            <sort_order>0</sort_order>
                        </pincode>
                    </children>
                </pincode>
            </children>
        </admin>
    </resources>
</acl>
<layout>
    <updates>
        <pincode>
            <file>pincode.xml</file>
        </pincode>
    </updates>
</layout>
</adminhtml>
1

Your Answer

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

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