2

I'm using below code in adminhtml/menu.xml to show menu/sub-menu in admin. I'm able to see menu Lapisbard in admin but sub-menu Store Locations is not visible when I click on menu named Lapisbard.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Backend/etc/menu.xsd">
    <menu>
        <add id="lapisbard::base" title="Lapisbard" module="Lapisbard_StoreLocator" sortOrder="90" resource="Lapisbard_StoreLocator::storelocator" />
        <add id="lapisbard_storelocator::locations" title="Store Locations" module="Lapisbard_StoreLocator" sortOrder="10" parent="lapisbard::base" action="lapisbard_storelocator/locations/" resource="Lapisbard_StoreLocator::locations"/>
    </menu>
</config> 

If I'm adding it in content section using parent="Magento_Backend::content" it's working fine there.

<menu>
    <add id="Lapisbard_StoreLocator::storelocator" title="Lapisbard" module="Lapisbard_StoreLocator" sortOrder="90" parent="Magento_Backend::content" resource="Lapisbard_StoreLocator::storelocator" />
    <add id="Lapisbard_StoreLocator::locations" title="Store Locations" module="Lapisbard_StoreLocator" sortOrder="10" parent="Lapisbard_StoreLocator::storelocator" action="blog/post" resource="Lapisbard_StoreLocator::locations"/>
</menu>
1
  • @PrincePatel, I tried the given solutions while I was working on this, unfortunately none of the given solution worked other than the one I've mentioned in the the question.
    – amitshree
    Commented Jul 24, 2017 at 10:17

2 Answers 2

2

I think you're missing the acl here.

     <menu>
        <add id="Company_Module::dashboard" title="Dashboard1" module="Company_Module" sortOrder="12" resource="Company_Module::dashboard"/>
        <add id="Company_Module::subdashboard" title="Subdashboard" module="Company_Module" sortOrder="12" action="company/dashboard" resource="Company_Module::dashboard" parent="Company_Module::dashboard"/>
    </menu>

and acl like:

    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Company_Module::dashboard" title="Dashboard" sortOrder="12" />
            </resource>
        </resources>
    </acl>

Basically, your problem lies in the permissions. If you inherit it from Backend, you are using the Backend's permissions, and you are fine. But if you want to have submenu, you need your own acl.

0

js and css permission issue may cause this.

please give proper permission to the folder structure.

clear cache after permission.

run php bin/magento setup:static-content:deploy if you found js or css missing and than give proper permission once again.

I hope this will help you.

2
  • tried depoying content as well as giving proper permission. Is it compulsory to create ACL in Magento2?. It is affecting sub-menu of other module also.
    – amitshree
    Commented Jan 4, 2016 at 12:25
  • check proper permission also. Commented Jan 4, 2016 at 12:26

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.