2

I am struggling to add a non-category custom menu in the navigation bar and also a sub-menu. Please help. Thanks.

Piyush
  • 5,893
  • 9
  • 34
  • 64
Mudz7
  • 61
  • 2
  • 4
  • You can use as metioned in https://magento.stackexchange.com/questions/95017/adding-a-non-category-link-to-the-navigation-links-in-magento-2 – Kishan Patadia Feb 16 '18 at 05:37
  • I managed to add a link in the navigation bar. But how do i add submenu item now? – Mudz7 Feb 16 '18 at 06:14

4 Answers4

1

For people looking for a solution, I was facing the same issue, but after some research I found an event the Block which generate the menu. I also found another stack exchange response which worked for me.

https://magento.stackexchange.com/a/212369/50805

Aubin
  • 11
  • 1
0

one alternative solution is that

create one new category and assign cms block to it

and add cms page code to that cms block

everything works as per you needed.

Sandeep
  • 42
  • 4
0

You can try this way:-

Extend this file from core:-

app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/topmenu.phtml

<nav class="navigation" data-action="navigation">
    <ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
        <?php /* @escapeNotVerified */ echo $_menu; ?>
        <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?>
        <li>Test menu</li>
    </ul>
</nav>

It will add a menu in the end.

Rajbir Singh
  • 61
  • 1
  • 8
-1

Please find the below code for Main menu and submenus.

<?xml version = "1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">
    <menu>
        <!--Main Menu-->
        <update id="Arise_Extensions::menu" title="Arise Extensions" module="Arise_Contact" sortOrder="10"
                resource="Arise_Extensions::menu"/>
        <!-- Sub Section 1 -->
        <add id="Arise_Contact::contacts_manager" title="Arise Contacts" module="Arise_Contact" sortOrder="10"
             parent="Arise_Extensions::menu" dependsOnModule="Arise_Contact"
             resource="Arise_Contact::contacts_manager"/>
        <!-- Sub Section 1 Links-->
        <add id="Arise_Contact::manage_contacts" title="Manage Contacts" module="Arise_Contact" sortOrder="10"
             parent="Arise_Contact::contacts_manager" action="Arise_contacts/manage_contacts"
             resource="Arise_Contact::manage_contacts"/>
        <add id="Arise_Contact::Arise_contacts_settings" title="Manage Contact Settings" module="Arise_Contact"
             sortOrder="20" parent="Arise_Contact::contacts_manager"
             action="adminhtml/system_config/edit/section/Arise_contacts"
             resource="Arise_Contact::Arise_contacts_settings"/>
        <!--/Sub Section 1 Links-->
    </menu>
</config>
Sandeep
  • 42
  • 4
  • I want to add the menu item in the home page navigation bar in the frontend, not in the backend. :) – Mudz7 Feb 16 '18 at 06:13