Reputation: 509
I want to add some information to the checkout success page by adding a block to the page (without duplicating the template page and changing it).
I've looked at the downloadable module and tried to copy it but that didn't work. I have a custom module and I've tried to do this :
1) adding a block file to : ...\app\code\local\SHANI\MyModule\Block\checkout\Details.php
class SHANI_MyModule_Block_Checkout_Details extends Mage_Checkout_Block_Onepage_Success
{
}
2) adding a template file to : ...\app\design\frontend\default\default\template\mymodule\checkout\details.phtml
<?php
echo "test ffdagdf";
?>
3) adding the block to : ...\app\design\frontend\default\default\layout\mymodule.xml
<default>
</default>
....
....
....
<checkout_onepage_success>
<reference name="checkout.success">
<block type="mymodule/checkout_success" name="mymodule.checkout.details" template="mymodule/checkout/details.phtml"/>
</reference>
</checkout_onepage_success>
Does that the way to do it? What am I missing?
///////////////////////////////////////// update/////////////////////////////////////////
I've tried to change the mymodule.xml like Lrrr wrote but still no luck...
<checkout_onepage_success>
<reference name="checkout.success">
<block type="mymodule/checkout_details" name="mymodule.checkout.details" template="mymodule/checkout/details.phtml"/>
</reference>
</checkout_onepage_success>
any other ideas what is the problem?
I'm trying to do the same thing with the product view page and I was able to add a block to the "product.info.additional" but not to the "product.info".
This is working:
<catalog_product_view>
<reference name="product.info.additional">
<block type="catalog/product_view" name="mymodule.saledetails" before="-" template="mymodule/product/details.phtml"/>
<block type="mymodule/product_participant_list" name="mymodule.participants" before="-" template="mymodule/product/participant/list.phtml"/>
</reference>
</catalog_product_view>
But this isn't
<catalog_product_view>
<reference name="product.info">
<block type="catalog/product_view" name="mymodule.saledetails" before="-" template="mymodule/product/details.phtml"/>
</reference>
<reference name="product.info.additional">
<block type="mymodule/product_participant_list" name="mymodule.participants" before="-" template="mymodule/product/participant/list.phtml"/>
</reference>
</catalog_product_view>
I'm trying to move this block from "product.info.additional" to "product.info" because I want to show this block under the Quick Overview (in the default template) and not under the Details. Why doesn't it work under the "product.info"?
Upvotes: 3
Views: 10472
Reputation: 12750
try to reference the content block in success page layout
<checkout_onepage_success>
<reference name="content">
<block type="mymodule/checkout_success" name="mymodule.checkout.details" template="mymodule/checkout/details.phtml"/>
</reference>
</checkout_onepage_success>
instead checkout.success and you probably will need to call $this->getChildHtml('yourblockname')
in template or add output="toHtml"
to your block in layout
Upvotes: 2
Reputation: 2282
<block type="core/template" name="parent" template="parent.phtml>
<block type="core/template" name="child" template="child" />
</block>
If You put in parent.phtml this print $this->getChildHtml('child')
Magento should render child.phtml inside parent.phtml
As for Your other question... Some block render all blocks that are childs to them, but some renders only those blocks that are echo'ed inside their template. So 'product.info.additional' can use echo $this->getChildHtml()
and 'product.info' can use echo $this->getChildHtml('block_name')
Please provide me Your module config.xml
Upvotes: 0
Reputation: 2282
Try
print $this->getChildHtml('mymodule.checkout.details')
inside parent template without output="" in xml.
You can also check log for aditional info.
And to be sure it's now fault of Your block replace it with
type="core/template"
If Your module is
SHANI_MyModule_Block_Checkout_Details
then type should be
type="mymodule/checkout_details"
Upvotes: 0