1

I have a custom menu on the dashboard, and I need to group the items through the parent item in the menu, as shown in the attach. Thanks

enter image description here

My custom menu.

enter image description here

  • please explain clearly – Rk Rathod May 21 at 8:51
  • Rk Rathod, I attached an image I need to add a parent (as shown through the arrows) for grouping – Robinio Tor May 21 at 8:55
  • in your custom menu ??? – Rk Rathod May 21 at 8:55
  • Rk Rathod, yes in my custom menu – Robinio Tor May 21 at 8:56
  • please attach screenshot for your custom menu – Rk Rathod May 21 at 8:56
2

Replace menu.xml file with this :-

<?xml version="1.0"?> 
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"> 
<menu> 
<add id="Magento_CatalogRule::calendardisplayproductnotification" 
     title="New basket notification date" 
     module="Dashcalendar_Calendar" 
     sortOrder="0" 
     parent="Magento_CatalogRule::promo" 
     action="calendar/calendardisplayproductnotification" 
     resource="Magento_Backend::content"/> 

<add id="Magento_CatalogRule::calendarmodify" 
     title="Basket modification dates" 
     module="Dashcalendar_Calendar" 
     sortOrder="1" 
     parent="Magento_CatalogRule::promo" 
     action="calendar/calendarmodify" 
     resource="Magento_Backend::content"/> 

<add id="Magento_CatalogRule::deliverydatesummer" 
     title="Delivery schedule for summer season" 
     module="Dashcalendar_Calendar" 
     sortOrder="2" 
     parent="Magento_CatalogRule::promo" 
     action="calendar/deliverydatesummer" 
     resource="Magento_Backend::content"/> 

<add id="Magento_CatalogRule::deliverydatewinter" 
     title="Delivery schedule for winter season" 
     module="Dashcalendar_Calendar" 
     sortOrder="3" 
     parent="Magento_CatalogRule::promo" 
     action="calendar/deliverydatewinter" 
     resource="Magento_Backend::content"/> 

<add id="Magento_CatalogRule::productcheckoutday" 
     title="Products Checkout Days" 
     module="Dashcalendar_Calendar" 
     sortOrder="4" 
     parent="Magento_CatalogRule::promo" 
    action="calendar/productcheckoutday" 
    resource="Magento_Backend::content"/> 
</menu> 
</config>
1

Here in my example, I have created different modules and different menu.xml as per my requirement. You can keep this content in only one menu.xml file also.

  1. Main Parent Menu Item at path app/code/A/Core/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="A_Core::menu" title="Example Title" module="A_Core" translate="title" sortOrder="70" resource="A_Core::menu"/>        
    </menu>
</config>
  1. One of the Child Menu Item at path app/code/A/ElasticSearch/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="A_ElasticSearch::search" title="Search Management" module="A_ElasticSearch" sortOrder="50" parent="A_Core::menu" resource="A_ElasticSearch::search"/>    
        <add id="A_ElasticSearch::search_index" title="Search Indexes" module="A_ElasticSearch" sortOrder="10" parent="A_ElasticSearch::search" action="search/index" resource="A_ElasticSearch::search_index"/>    
        <add id="A_ElasticSearch::search_score_rule" title="Score Boost Rules" module="A_ElasticSearch" sortOrder="15" parent="A_ElasticSearch::search" action="search/scoreRule" resource="A_ElasticSearch::search_score_rule"/>    
    </menu>
</config>
  1. Other Child Menu Item at path app/code/A/BannerSlider/etc/adminhtml/menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="A_BannerSlider::bannerslider" title="Banner Sliders" module="A_BannerSlider" sortOrder="100" resource="A_BannerSlider::bannerslider" parent="A_Core::menu"/>
        <add id="A_BannerSlider::banner" title="Manage Banner" module="A_BannerSlider" sortOrder="20" parent="A_BannerSlider::bannerslider" action="bannerslider/banner/index" resource="A_BannerSlider::banner"/>
        <add id="A_BannerSlider::slider" title="Manage Slider" module="A_BannerSlider" sortOrder="30" parent="A_BannerSlider::bannerslider" action="bannerslider/slider/index" resource="A_BannerSlider::slider"/>
    </menu>
</config>

Above added menu items look like this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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