1

I have been trying to create an additional tab in navigation.sections and insert inside languages, and my own account (complete with a menu), login, logout that I have created outside header.links, they work good on desktop but cannot manage to make them appear in navigation.sections ( the xml managing content of the offcanvas menu),

I have tried different approach, I have started with inserting just the customer.phtml, the latest is (in MyName/myTheme/Magento_Theme/layout/default.xml):

<block class="Magento\Framework\View\Element\Template" name="store.information" group="navigation-sections" template="Magento_Theme::html/container.phtml">
            <arguments>
                <argument name="title" translate="true" xsi:type="string">Information</argument>
            </arguments>
                <block class="Magento\Customer\Block\Account\Customer" name="store.settings.customer" template="Magento_Customer::account/customer.phtml">
                    <arguments>
                        <argument name="id_modifier" xsi:type="string">nav</argument>
                    </arguments>
                </block>
                <block class="Magento\Customer\Block\Form\Login" name="store.settings.custom_customer_form_login" template="Magento_Customer::form/login_pop.phtml" >
                <arguments>
                        <argument name="id_modifier" xsi:type="string">nav</argument>
                    </arguments>
                        <block class="Magento\Customer\Block\Form\Login\Info" name="newpopup" template="Magento_Customer::newpopup.phtml"/>
                  </block>
                  <block class="Magento\Store\Block\Switcher" name="store.settings.language" template="Magento_Store::switch/languages.phtml">
                    <arguments>
                        <argument name="id_modifier" xsi:type="string">nav</argument>
                    </arguments>
                </block>
                <block class="Magento\Directory\Block\Currency" name="store.settings.currency" template="Magento_Directory::currency.phtml">
                    <arguments>
                        <argument name="id_modifier" xsi:type="string">nav</argument>
                    </arguments>
                </block>


        </block>

The result is all title to dropdownDialog are there, but the dropdwon itself is not present, even if the phtml called is already in the page and working under another layout name.

6
  • I think you are looking for tab in mobile view right? Aug 31, 2018 at 13:38
  • Yes, there is where the offcanvas is. Aug 31, 2018 at 13:48
  • Are you logged in? Aug 31, 2018 at 15:10
  • I try both logged and not, no real difference Aug 31, 2018 at 15:15
  • Actually if you check customer.phtml the codes says if customer logged in then it will show. Can you try to call different file instead of customer.phtml and paste some dummy content. Aug 31, 2018 at 15:17

1 Answer 1

0

This finally worked

<referenceContainer name="page.top">
        <block class="Magento\Framework\View\Element\Template" name="navigation.sections" before="-" template="Magento_Theme::html/sections.phtml">
            <arguments>
                <argument name="group_name" xsi:type="string">navigation-sections</argument>
                <argument name="group_css" xsi:type="string">nav-sections</argument>
            </arguments>
            <block class="Magento\Framework\View\Element\Template" name="store.menu" group="navigation-sections" template="Magento_Theme::html/container.phtml">
                <arguments>
                    <argument name="title" translate="true" xsi:type="string">Menu</argument>
                </arguments>
                <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" ttl="3600" before="-"/>
            </block>
            <block class="Magento\Framework\View\Element\Template" name="store.information" group="navigation-sections" template="Magento_Theme::html/container.phtml">
            <arguments>
                <argument name="title" translate="true" xsi:type="string">Account</argument>
            </arguments>
            </block>


        </block>
        <container name="top.container" as="topContainer" label="After Page Header Top" htmlTag="div" htmlClass="top-container"/>
        <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
    </referenceContainer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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