1

I've added some links in my menu in customer_account.xml

But items don't go one below the other, they're one next to each other (for my custom links only, default links are ok)

This is my customer_account.xml

<referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link" name="customer-account-navigation-contacts">
                <arguments>
                    <argument name="path" xsi:type="string">mycontacts/contacts/index</argument>
                    <argument name="label" xsi:type="string">Mes contacts</argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Link" name="customer-account-navigation-factures" after="customer-account-navigation-contacts" >
                <arguments>
                    <argument name="path" xsi:type="string">mybills/factures/index</argument>
                    <argument name="label" xsi:type="string">Mes factures</argument>
                </arguments>
            </block>
        </referenceBlock>

Result

3 Answers 3

1

Try Below Code :

<referenceBlock name="customer_account_navigation">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="first-link">
            <arguments>
                <argument name="path" xsi:type="string">path/to/Controller</argument>
                <argument name="label" xsi:type="string">First Link</argument>
                <argument name="sortOrder" xsi:type="number">2</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="First Link">
            <arguments>
                <argument name="path" xsi:type="string">path/to/controller</argument>
                <argument name="label" xsi:type="string">Second Link</argument>
                <argument name="sortOrder" xsi:type="number">22</argument>
            </arguments>
        </block>
    </referenceBlock>
2
  • Nop, same result
    – Morgan
    Commented Jun 22, 2018 at 10:13
  • Post screenshot how you are getting.
    – anonymous
    Commented Jun 22, 2018 at 10:15
0

Try this one :

<referenceBlock name="customer_account_navigation">
       <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-custom-link-one" after="-" >
              <arguments>
                  <argument name="label" xsi:type="string" translate="true">Custom Link Label 1</argument>
                  <argument name="path" xsi:type="string">your-custom-path</argument>
              </arguments>
       </block>
       <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-custom-link-two" after="-" >
              <arguments>
                  <argument name="label" xsi:type="string" translate="true">Custom Link Label 2</argument>
                  <argument name="path" xsi:type="string">your-custom-path</argument>
              </arguments>
       </block>
 </referenceBlock>
0

Try this code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
    <body>
        <attribute name="class" value="account"/>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="custom-link-one">
                <arguments>
                    <argument name="path" xsi:type="string">your-custom-path</argument>
                    <argument name="label" xsi:type="string">Custom Link Label 1</argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="custom-link-two">
                <arguments>
                    <argument name="path" xsi:type="string">your-custom-path</argument>
                    <argument name="label" xsi:type="string">Custom Link Label 2</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

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.