문제

The custom module menu shows under Role Resources. Under Role Resources I click the check-box and save. I then reload the role and the check-box is no longer checked. I basically copied the menu items to the ACL XML element. Why is this happening?

config.xml

<?xml version="1.0"?>
<config>
...
    <adminhtml>
        <menu>
            <customModuleHeader translate="title" module="custommodule">
                <title>customModule</title>
                <sort_order>60</sort_order>
                <children>
                    <custommodule_configform translate="title" module="custommodule">
                        <title>custommodule Configuration</title>
                        <sort_order>50</sort_order>
                        <children>
                            <custommodule_configform translate="title" module="custommodule">
                                <title>Settings</title>
                                <action>custommodule/adminhtml_configuration</action>
                                <sort_order>10</sort_order>
                            </custommodule_configform>
                        </children>
                    </custommodule_configform>
                </children>
            </customModuleHeader>
        </menu>
        <layout>
...

admin.html

<?xml version="1.0"?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <customModuleHeader translate="title" module="custommodule">
                        <title>customModule</title>
                        <sort_order>60</sort_order>
                        <children>
                            <custommodule_configform translate="title" module="custommodule">
                                <title>custommodule Configuration</title>
                                <sort_order>50</sort_order>
                                <children>
                                    <custommodule_configform translate="title" module="custommodule">
                                        <title>Settings</title>
                                        <sort_order>10</sort_order>
                                    </custommodule_configform>
                                </children>
                            </custommodule_configform>
                        </children>
                    </customModuleHeader>
                </children>
            </admin>
        </resources>
    </acl>
</config>
도움이 되었습니까?

해결책

This is syntax how to create the Menu in Magento Admin Panel you can follow this

/app/code/local///etc/adminhtml.xml

<?xml version="1.0"?>
<config>
<menu>
    <[module] module="[module]">
        <title>[Module]</title>
        <sort_order>71</sort_order>               
        <children>
            <items module="[module]">
                <title>Manage Items</title>
                <sort_order>0</sort_order>
                <action>[module]/adminhtml_[module]</action>
            </items>
        </children>
    </[module]>
</menu>
<acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <[module]>
                    <title>[Module] Module</title>
                    <sort_order>200</sort_order>
                </[module]>
            </children>
        </admin>
    </resources>   
</acl>
<layout>
    <updates>
        <[module]>
            <file>[module].xml</file>
        </[module]>
    </updates>
</layout>

다른 팁

This happens because of menu section tags are not similar to ACL tags. I checked the code snippets provided by you. But there were no any mistakes. I suggest you to check these both sections (menu declaration and ACL) thoroughly.

(At the same time make sure you have NOT defined ACL inside admin.html as per in your question )

You can put both menu declaration and ACL inside adminhtml.xml

Below is a sample code which you can follow.

<?xml version="1.0" ?>
<config>
    <menu>
        <mycustom_menu translate="title" module="YOUR_MODULE_NAME">
            <title>My Menu</title>
            <sort_order>100</sort_order>
            <children>
                <!-- children -->
                <subitem translate="title" module="YOUR_MODULE_NAME">
                    <title>Subitem</title>
                    <sort_order>10</sort_order>
                    <action>adminhtml/mycustom_controller/</action>
                </subitem>
            </children>
        </mycustom_menu>
    </menu>
    <acl>
        <resources>
            <admin>
                <children>
                    <mycustom_menu translate="title" module="YOUR_MODULE_NAME">
                        <title>My Menu</title>
                        <sort_order>300</sort_order>
                        <children>
                            <!-- children -->
                            <subitem translate="title" module="YOUR_MODULE_NAME">
                                <title>Subitem</title>
                                <sort_order>10</sort_order>
                            </subitem>
                        </children>
                    </mycustom_menu>
                </children>
            </admin>
        </resources>
    </acl>
</config>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top