Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a page called hello.phtml, which resides in
I want to include this phtml file in the success page
i.e template/checkout/success.phtml
So I have create a block in the checkout.xml inside "checkout_onepage_success>" handle as..

<checkout_onepage_success translate="label">
    <label>One Page Checkout Success</label>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
    <reference name="content">
         <block type="core/template" name="onepagehello" template="checkout/onepage/hello.phtml"/>
        <block type="checkout/onepage_success" name="checkout.success" template="checkout/success.phtml"/>

And this phtml file get rendered in the success page on the top of the page.
When I write getChildHtml(onepagehello); in the success.phtml page, then nothing came.
1.I want to know when the getChildHtml() works and when the direct block gets rendered ?
2.I want to use the "hello.phtml" as getChildHtml().So that I can put this block wherever necessary throughout the page.

share|improve this question
up vote 5 down vote accepted

The layout is a hierarchy of blocks and getChildHtml() can only render the children of the current block.

Right now your hierarchy looks like this:

+-- content
    +-- onepagehello
    +-- checkout.success

but you need this:

+-- content
    +-- checkout.success
        +-- onepagehello

To add a new block to an existing parent block, use <reference>:

    <reference name="checkout.success">
         <block type="core/template" name="onepagehello" template="checkout/onepage/hello.phtml"/>
share|improve this answer
Thank you for the concept @fschmengler.It worked.. I wonder where can I find these simple fundamental concept which makes the base of magento.. – Kishore Patra Jan 18 at 11:48
For fundamentals of Magento layout I recommend Alan Storms blog at You can also find a curated list of Magento resources at – fschmengler Jan 18 at 12:33
Thanks again for sharing the resources, @fschmengler. – Kishore Patra Jan 18 at 13:32
what u doing Fabian... you have impress me day by day..what explanation..:) – Amit Bera Jan 18 at 19:22

Just add element as="NAME" on your block like this

<block type="core/template" name="onepagehello" template="checkout/onepage/hello.phtml" as="hello"/>

you can call like this

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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