Domanda

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

È stato utile?

Soluzione

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>

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top