Reputation: 970
I need to call a custom block on success page
I have tried by layout as mention below
<checkout_onepage_success translate="label">
<reference name="content">
<block type="checkout/onepage_success" name="checkout.success" template="checkout/success.phtml" >
<block type="core/template" name="birthday" template="checkout/message/birthday.phtml"/>
</block>
</reference>
</checkout_onepage_success>
In success page
echo $this->getChildHtml('birthday');
I am getting birthday block twice on the page.
Please let me know how we can call custom block on success page.
I don't want to use dynamic block i.e.
echo $this->getLayout()->createBlock('core/template')
->setTemplate('checkout/message/birthday.phtml')->toHtml();
Upvotes: 1
Views: 1198
Reputation: 15206
You are getting the birthday
block twice because of this line from success.phtml:
<?php echo $this->getChildHtml() ?>
This line renders all child blocks of the main block.
If you want it listed only once remove the line
echo $this->getChildHtml('birthday');
It will be redered by the getChildHtml
method anyway.
Upvotes: 4