0

I try to assign a CSS class to navigation ( tag) under customer account page.

I found this file customer_account.xml, and I added <argument name="css_class" xsi:type="string">sidebar-navigation__item-link</argument> to the block, as following

                    <block class="Magento\Customer\Block\Account\SortLinkInterface"
                           name="customer-account-navigation-address-link">
                        <arguments>
                            <argument name="css_class" xsi:type="string">sidebar-navigation__item-link</argument>
                            <argument name="label" xsi:type="string" translate="true">Address Book</argument>
                            <argument name="path" xsi:type="string">customer/addresss</argument>
                            <argument name="sortOrder" xsi:type="number">190</argument>
                        </arguments>
                    </block>

But this doesn't give any effect on the frontpage. I have cleared the cache.

Did I miss anything?

1

Try following way:

<block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-orders-link-2">
    <arguments>
        <argument name="path" xsi:type="string">sales/order/history</argument>
        <argument name="label" xsi:type="string" translate="true">My Orders 2</argument>
        <argument name="sortOrder" xsi:type="number">230</argument>
        <argument name="attributes" xsi:type="array">
            <item name="class" xsi:type="string">my_custom_link</item>
        </argument>
    </arguments>
</block>
  • It's working. Thanks. how come I didn't know this. – Magento Learner Mar 7 at 9:10

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.