1

I need to put my html/js code just before end of body tag (</body>) on last checkout page (\template\checkout\success.phtml)

But after success.phtml I still have footer and wraper code. How to move my code from end of template success.phtml to end of whole page.

This needs to be only for that page, not for whole website.

1 Answer 1

2

You can add this to ...

app/design/frontend/THEME/PACKAGE/layout/local.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <checkout_onepage_success>
        <reference name="before_body_end">
            <block type="your/blocktype" name="your_block_name" template="path/to/file.phtml" />
        </reference>
    </checkout_onepage_success>
</layout>

Just have to add your script-(links) to file.phtml and maybe adjust block type.

Edit:

If no custom methods are required use block type="core/template".

5
  • There is bunch of xml files in that folder, but there is no local.xml in both my and base theme. Commented May 15, 2017 at 15:06
  • 1
    If there is no local.xml, just create one in your theme :)
    – sv3n
    Commented May 15, 2017 at 15:07
  • Just i case you are the one who has upvoted and it fits for your needs, please also accept the answer. ;)
    – sv3n
    Commented May 15, 2017 at 15:42
  • What "blocktype" should be ? When I set "checkout/onepage_success" it's at the end of template, not whole page, and if I put on "page/html_footer", it mess my footer completly, i lose some elements. Commented May 16, 2017 at 7:36
  • Updated my answer.
    – sv3n
    Commented May 16, 2017 at 10:35

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.