3

My custom module is not showing its menus in another user role account.

Here is the adminhtml.xml--

<?xml version="1.0"?>
<config>
    <menu>
        <kartparadigm_storecredit module="kartparadigm_storecredit">
            <title>Store Credit</title>
            <sort_order>71</sort_order>
            <children>
                <settings module="kartparadigm_storecredit">
                    <title>Settings</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/settings</action>
                </settings>
                <customers module="kartparadigm_storecredit">
                    <title>Manage Customer Credits</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/customer</action>
                </customers>
                <transactions module="kartparadigm_storecredit">
                    <title>Manage Transactions</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/index</action>
                </transactions>
            </children>
        </kartparadigm_storecredit>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <storecredit translate="title" module="kartparadigm_storecredit">
                        <title>Credits</title>
                        <sort_order>300</sort_order>
                        <children>
                           <transactions translate="title" module="kartparadigm_storecredit">
                             <title>Manage Transaction</title>
                             <sort_order>1</sort_order>
                           </transactions>
                           <customers translate="title" module="kartparadigm_storecredit">
                              <title>Manage Customer Credits</title>
                              <sort_order>2</sort_order>
                           </customers>
                           <settings translate="title" module="kartparadigm_storecredit">
                                <title>Settings</title>
                                <sort_order>3</sort_order>
                           </settings>
                        </children>
                     </storecredit>
                     <system>
                        <children>
                            <config>
                                <children>
                                    <mycustom_section translate="title" module="kartparadigm_storecredit">
                                        <title>My Custom Section</title>
                                        <sort_order>100</sort_order>
                                    </mycustom_section>
                                </children>
                            </config>
                        </children>
                     </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

I have also used this code in controller--

protected function _isAllowed()
{
        return true;
}

Although it is showing in Role Resources as below image--

enter image description here

But when I login with different account it does not show menus. I can't find out where is the problem. can anyone help me ?

2
  • 1
    you need to assign permission to other user from super user
    – Amit Bera
    Feb 8, 2016 at 12:48
  • @Amit, I have assigned permission from superadmin and then have refreshed cache and did reindexed also and also logged out and login again from another user account. still not working. Feb 8, 2016 at 12:51

3 Answers 3

2

add menu in ACL

<?xml version="1.0"?>
<config>
    <menu>
        <kartparadigm_storecredit module="kartparadigm_storecredit">
            <title>Store Credit</title>
            <sort_order>71</sort_order>
            <children>
                <settings module="kartparadigm_storecredit">
                    <title>Settings</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/settings</action>
                </settings>
                <customers module="kartparadigm_storecredit">
                    <title>Manage Customer Credits</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/customer</action>
                </customers>
                <transactions module="kartparadigm_storecredit">
                    <title>Manage Transactions</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/index</action>
                </transactions>
            </children>
        </kartparadigm_storecredit>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>

                     <system>
                        <children>
                            <config>
                                <children>
                                    <mycustom_section translate="title" module="kartparadigm_storecredit">
                                        <title>My Custom Section</title>
                                        <sort_order>100</sort_order>
                                    </mycustom_section>
                                </children>
                            </config>
                        </children>
                     </system>
                     <kartparadigm_storecredit module="kartparadigm_storecredit">
            <title>Store Credit</title>
            <sort_order>71</sort_order>
            <children>
                <settings module="kartparadigm_storecredit">
                    <title>Settings</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/settings</action>
                </settings>
                <customers module="kartparadigm_storecredit">
                    <title>Manage Customer Credits</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/customer</action>
                </customers>
                <transactions module="kartparadigm_storecredit">
                    <title>Manage Transactions</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/index</action>
                </transactions>
            </children>
        </kartparadigm_storecredit>
                </children>
            </admin>
        </resources>
    </acl>
</config>
5
  • can you please explain your answer.? Feb 8, 2016 at 12:58
  • first i want to know it is worked or not then i will explain.. Feb 8, 2016 at 13:01
  • The new code that you have inputted is already there above <system> tag. So I don't know why you added again it. Although it is not working. i have tried this. Feb 8, 2016 at 13:03
  • ok i will tell you it worked for me. system tag for system configuration and you added the menu so it can list in role permission but you are not add your menu in access control list. for role permission you need to add it access control list. Feb 8, 2016 at 13:05
  • 1
    you menu have inside these tag kartparadigm_storecredit but you acl is in this tag storecredit make the same parent for both. Feb 8, 2016 at 13:08
1

In adminhtml.xml

<?xml version="1.0"?>
<config>
    <menu>
        <storecredit module="kartparadigm_storecredit">
            <title>Store Credit</title>
            <sort_order>71</sort_order>
            <children>
                <settings module="kartparadigm_storecredit">
                    <title>Settings</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/settings</action>
                </settings>
                <customers module="kartparadigm_storecredit">
                    <title>Manage Customer Credits</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/customer</action>
                </customers>
                <transactions module="kartparadigm_storecredit">
                    <title>Manage Transactions</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml/credits/index</action>
                </transactions>
            </children>
        </storecredit>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <storecredit translate="title" module="kartparadigm_storecredit">
                        <title>Credits</title>
                        <sort_order>300</sort_order>
                        <children>
                           <transactions translate="title" module="kartparadigm_storecredit">
                             <title>Manage Transaction</title>
                             <sort_order>1</sort_order>
                           </transactions>
                           <customers translate="title" module="kartparadigm_storecredit">
                              <title>Manage Customer Credits</title>
                              <sort_order>2</sort_order>
                           </customers>
                           <settings translate="title" module="kartparadigm_storecredit">
                                <title>Settings</title>
                                <sort_order>3</sort_order>
                           </settings>
                        </children>
                     </storecredit>
                     <system>
                        <children>
                            <config>
                                <children>
                                    <mycustom_section translate="title" module="kartparadigm_storecredit">
                                        <title>My Custom Section</title>
                                        <sort_order>100</sort_order>
                                    </mycustom_section>
                                </children>
                            </config>
                        </children>
                     </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

In controller file

protected function _isAllowed()
{
    return Mage::getSingleton('admin/session')->isAllowed('system/acl/storecredit');
}
1

I had same problem. In the menu section you're using

<kartparadigm_storecredit module="kartparadigm_storecredit">

but in acl you have

<storecredit translate="title" module="kartparadigm_storecredit">

You should use same code in both sections.
So your menu section should looks like this:

<menu>
    <storecredit module="kartparadigm_storecredit">
        <title>Store Credit</title>
        <sort_order>71</sort_order>
        <children>
            <settings module="kartparadigm_storecredit">
                <title>Settings</title>
                <sort_order>0</sort_order>
                <action>adminhtml/credits/settings</action>
            </settings>
            <customers module="kartparadigm_storecredit">
                <title>Manage Customer Credits</title>
                <sort_order>0</sort_order>
                <action>adminhtml/credits/customer</action>
            </customers>
            <transactions module="kartparadigm_storecredit">
                <title>Manage Transactions</title>
                <sort_order>0</sort_order>
                <action>adminhtml/credits/index</action>
            </transactions>
        </children>
    </storecredit>
</menu>

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.