1

I create a custome theme based on Blank theme, I want to display top.links in header like in the following image:

enter image description here

How I can add that links and much important that Basket like in the image?

Thanks

2 Answers 2

1

=> Go to your custom theme & add this below code :-

app/design/frontend/{Vendor}/{theme}/Magento_Theme/layout/default.xml

<referenceContainer name="header.panel">
        <block class="Magento\Framework\View\Element\Html\Links" name="top.links">
             <block class="Magento\Framework\View\Element\Html\Link\Current" name="my-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">My Cart</argument>
                    <argument name="path" xsi:type="string">checkout/cart</argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="my-link1">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Checkout</argument>
                    <argument name="path" xsi:type="string">checkout</argument>
                </arguments>
            </block>                   
        </block>
    </referenceContainer>  
<block class="Magento\Framework\View\Element\Html\Link\Current" name="my-link1">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">My Account</argument>
                    <argument name="path" xsi:type="string">customer/account/login/</argument>
                </arguments>
            </block>                   
        </block>
    </referenceContainer>
1
  • Hi thanks, but I not see where is the Basket total?
    – Robert
    Nov 3, 2017 at 9:04
-1
<referenceBlock name="top.links">
    <block class="Magento\Framework\View\Element\Html\Link\Current" name="your.global.link.identifier">
        <arguments>
            <argument name="label" xsi:type="string" translate="true">Label</argument>
            <argument name="path" xsi:type="string">path</argument>
        </arguments>
    </block>
</referenceBlock>
3
  • and how I can add basket link with total?
    – Robert
    Nov 3, 2017 at 9:05
  • you should set attribute data-mage-init, create js script and update link from js or set custom template for link and use custom renderers for that also can be usefull both variants Nov 3, 2017 at 23:38
  • can you update your answer and put this modifications there too?
    – Robert
    Nov 4, 2017 at 9:12

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.