2

I want my top links in the order like:

  1. My Account
  2. My Wishlist
  3. My Orders
  4. Sign In

But I am getting like:

  1. My Account
  2. My Wishlist
  3. Sign In
  4. My Orders

Below is my code:

<referenceBlock name="top.links">
        <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link" before="my-account-link"
               template="Magento_Customer::account/link/authorization.phtml"/>

        <block class="Magento\Customer\Block\Account\Link" name="my-account-link" after="authorization-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">My Account</argument>
                <argument name="sortOrder" xsi:type="number">110</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-orders-link-top" after="my-account-link" before="-">
            <arguments>
                <argument name="path" xsi:type="string">sales/order/history</argument>
                <argument name="label" xsi:type="string" translate="true">My Orders</argument>
            </arguments>
        </block>

        <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
            </arguments>
        </block>

    </referenceBlock>
2

Try the below code instead of yours:

<referenceBlock name="top.links">
    <block class="Magento\Customer\Block\Account\Link" name="my-account-link">
        <arguments>
            <argument name="label" xsi:type="string" translate="true">My Account</argument>
            <argument name="sortOrder" xsi:type="number">110</argument>
        </arguments>
    </block>
    <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-orders-link">
        <arguments>
            <argument name="path" xsi:type="string">sales/order/history</argument>
            <argument name="label" xsi:type="string" translate="true">My Orders</argument>
            <argument name="sortOrder" xsi:type="number">40</argument>
        </arguments>
    </block>
    <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link" after="customer-account-navigation-orders-link-top"
           template="Magento_Customer::account/link/authorization.phtml">
        <arguments>
            <argument name="sortOrder" xsi:type="number">10</argument>
        </arguments>
    </block>
</referenceBlock>

Flush the cache and test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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