1

I tried to insert an additional button on the wishlist page, but when I do that for some reason the order of all elements in a certain container gets reversed (that includes <script> elements!). What I did is something like this:

<?xml version="1.0" encoding="UTF-8" ?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="customer.wishlist.buttons">
            <block after="-"
                name="mycompany.blockname"
                class="MyCompany\ModulName\Block\BlockName"
                template="MyCompany_ModulName::template.phtml" />
        </referenceContainer>
    </body>
</page>

The button works alright, but now the Page title is below everything else on the page.

Compare this: https://i.imgur.com/rv0iH74.png

With this: https://i.imgur.com/mqndlHj.png

1

Just put the below code into wishlist_index_index.xml of your module

<move element="mycompany.blockname" destination="customer.wishlist.buttons" after="-"/>

Save the file and run below command from your Magento root

php bin/magento cache:flush

If still facing any issue feel free to revert back

Happy Coding! :)

|improve this answer|||||
  • 1
    Dont't run setup:upgrade command every time refer this answer: magento.stackexchange.com/a/184927/35758 – Prince Patel Feb 14 '18 at 6:01
  • Okay Thank You! @PrincePatel I was not aware of this. – Abhishek Tripathi Feb 14 '18 at 6:06
  • Now my answer is okay?? – Abhishek Tripathi Feb 14 '18 at 6:07
  • 1
    Use static-content:deploy only if you made changes with html, css, js, .... No need for layout changes. Now it's ok +1 from me – Prince Patel Feb 14 '18 at 6:34
  • But then no one will be able to use my module, if part of the installation instruction is "now open that other xml file and add this line at that location". – panzi Feb 14 '18 at 16:38

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.