0

I have created some links that i have added to my customer account nav.

But there's some problem :

  1. My links aren't order one under each other
  2. The class current is only active on "Mon cadencier" link.

Here's customer_account.xml :

<?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">
    <body>
        <referenceBlock name="customer_account_navigation">
            <block class="Magento\Customer\Block\Account\SortLinkInterface" 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>
                    <argument name="sortOrder" xsi:type="number">70</argument>
                </arguments>
            </block>
            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-factures">
                <arguments>
                    <argument name="path" xsi:type="string">mybills/factures/index</argument>
                    <argument name="label" xsi:type="string">Mes factures</argument>
                    <argument name="sortOrder" xsi:type="number">60</argument>

                </arguments>
            </block>
            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-reclamations">
                <arguments>
                    <argument name="path" xsi:type="string">mycomplaints/reclamations/index</argument>
                    <argument name="label" xsi:type="string">Mes réclamations</argument>
                    <argument name="sortOrder" xsi:type="number">50</argument>
                </arguments>
            </block>
            <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-cadencier">
                <arguments>
                    <argument name="path" xsi:type="string">customercadencier/order/cadencier</argument>
                    <argument name="label" xsi:type="string">Mon cadencier</argument>
                    <argument name="sortOrder" xsi:type="number">40</argument>
                </arguments>
            </block>

        </referenceBlock>


        <referenceBlock name="customer-account-navigation-address-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>
        <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
        <!--<referenceBlock name="customer-account-navigation-account-link" remove="true"/>-->
        <!--<referenceBlock name="customer-account-navigation-account-edit-link" remove="true"/>-->
        <!--<referenceBlock name="customer-account-navigation-orders-link" remove="true"/>-->
        <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
        <referenceBlock name="catalog.compare.sidebar" remove="true"/>
        <referenceContainer name="sidebar.additional" remove="true" />


    </body>
</page>

See the result :

result

1

1 Answer 1

0

Try this code :

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <body>
        <attribute name="class" value="account"/>
        <referenceContainer name="sidebar.main">

            <referenceBlock name="customer_account_navigation">
                <block class="Magento\Customer\Block\Account\SortLinkInterface" 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>
                        <argument name="sortOrder" xsi:type="number">70</argument>
                    </arguments>
                </block>
                <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-factures">
                    <arguments>
                        <argument name="path" xsi:type="string">mybills/factures/index</argument>
                        <argument name="label" xsi:type="string">Mes factures</argument>
                        <argument name="sortOrder" xsi:type="number">60</argument>

                    </arguments>
                </block>
                <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-reclamations">
                    <arguments>
                        <argument name="path" xsi:type="string">mycomplaints/reclamations/index</argument>
                        <argument name="label" xsi:type="string">Mes réclamations</argument>
                        <argument name="sortOrder" xsi:type="number">50</argument>
                    </arguments>
                </block>
                <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-cadencier">
                    <arguments>
                        <argument name="path" xsi:type="string">customercadencier/order/cadencier</argument>
                        <argument name="label" xsi:type="string">Mon cadencier</argument>
                        <argument name="sortOrder" xsi:type="number">40</argument>
                    </arguments>
                </block>
            </referenceBlock>
            <referenceBlock name="customer-account-navigation-address-link" remove="true"/>
            <referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
            <referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>
            <referenceBlock name="customer-account-navigation-billing-agreements-link" remove="true"/>
            <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/>
            <referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
            <referenceBlock name="customer-account-navigation-wish-list-link" remove="true"/>
            <referenceBlock name="catalog.compare.sidebar" remove="true"/>
            <referenceContainer name="sidebar.additional" remove="true" />
            </referenceContainer>
    </body>
</page>

Hope it will works.

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.