3

To Rearrange the Header links(ie to bring the My Wishlist link at last)in magento 2.0.2 (parent-theme:blank) I just overrided the default.xml file in

vendor/Magento/module_wishlist/view/frontend/layout/

into

app/design/frontend/<my_vendor>/<my_theme>/Magento_Wishlist/layout

and added after="authorization-link" to it like,

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="wish-list-link" after="authorization-link"/>
    </body>
</page>

But the order of the links didn't change. when I do it directly in vendor/Magento/modules_Wishlist/view/frontend/layout/default.xml changes are taking place. Kindly help me. Should anything be done additionally in order to override a layout file?

11
  • Please put your layout file inside app/design/frontend/<my_vendor>/<my_theme>/Magento_Wishlist/layout/override/theme/Magento/blank Instead of app/design/frontend/<my_vendor>/<my_theme>/Magento_Wishlist/layout Apr 23, 2016 at 10:22
  • Please let me know if it works. Apr 23, 2016 at 10:27
  • No it didn't work.
    – Ramya
    Apr 23, 2016 at 10:38
  • Can you share the path where did you put your layout xml file ? Also what is the name of your parent theme are you using ? Apr 23, 2016 at 10:39
  • Do you have <?xml version="1.0"?> at top of your file? Apr 23, 2016 at 10:45

2 Answers 2

0

You have to replace your xml file with this code,

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="top.links">
            <block class="Magento\Wishlist\Block\Link" name="wish-list-link" after="-"/>
        </referenceBlock>
    </body>
</page>

Remove cache and try again.

5
  • Kindly check my code above. I have did that already. Also I cleared my cache
    – Ramya
    Apr 23, 2016 at 10:05
  • check updated code and keep only above code in your theme xml file. Apr 23, 2016 at 10:08
  • No it is not changing :( Is there anything else that i should do in order to edit the overriden xml files?
    – Ramya
    Apr 23, 2016 at 10:14
  • THis is the way for getting xml file into theme and override those xml. Apr 23, 2016 at 10:16
  • But am not getting any changes done
    – Ramya
    Apr 23, 2016 at 10:31
0

EDIT: Try following 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">
    <body>
        <move element="wish-list-link" destination="top.links" after="authorization-link />
    </body>
</page>
4
  • Kindly check the my code in the question. I have given what you have mentioned.
    – Ramya
    Apr 23, 2016 at 10:32
  • Not exactly, you are using <block name="wish-list-link", and it should be <referenceBlock name="wish-list-link" Apr 23, 2016 at 10:34
  • I tried. Didn't work.
    – Ramya
    Apr 23, 2016 at 10:38
  • Can you update your question with latest version of file? Apr 23, 2016 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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