I have created a custom Extension.
In this Extension, I need to show some content in product description page.
How can i include that block using layout.xml.
<catalog_product_view translate="label">
 <reference name="content">
 <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
 .
 .
 .
 <-- My Block Load Here -->
 <block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
 .
 .
 .
 </block>
 </reference>
</catalog_product_view>
My Block Here:
<block type="xxx/yyyy" name="xxx.content" as="" template="xxx/xxx.phtml" />
What are the code add in my module xml file(app/design/frontend/default/default/layout/xxx.xml).
I no need to update anything in default phtml and layout file.
Please share your ideas.
Thanks.
2 Answers 2
Use inside your layout.xml
<catalog_product_view translate="label">
 <reference name="content">
 <block type="xxx/yyyy" name="xxx.content" as="" template="xxx/xxx.phtml" />
 </reference>
</catalog_product_view>
To position the block where you want, you can use before and after tags in your block as stated here.
- 
 I need to add my content in before add-to-cart button @mbalpardaVijayS91– VijayS912014年07月22日 12:14:55 +00:00Commented Jul 22, 2014 at 12:14
- 
 Get the name of the block and do <block type="xxx/yyyy" name="xxx.content" before="addto" as="" template="xxx/xxx.phtml" />mbalparda– mbalparda2014年07月22日 12:22:02 +00:00Commented Jul 22, 2014 at 12:22
- 
 1@VijayS. try adding an attributebefore="addto"to the block tag in the example above.Marius– Marius2014年07月22日 12:22:08 +00:00Commented Jul 22, 2014 at 12:22
- 
 @Marius I have try that above code its not working.VijayS91– VijayS912014年07月22日 12:30:20 +00:00Commented Jul 22, 2014 at 12:30
- 
 1@MeenakshiSundaramR. Sorry but I have no idea. The only way I know to do this is to use a different template for the product view page. Basically copy the view template in your custom module, modify the block using layout files and tell it to use your template and then modify your template and inject your block there. Not very elegant.Marius– Marius2014年07月22日 12:57:30 +00:00Commented Jul 22, 2014 at 12:57
Here the complete
First,check your current render is catalog_product_view
<catalog_product_view>
</catalog_product_view>
Then you reference blog name is name="product.info"
So, put
<reference name="product.info">
</reference>
Third: put you block ,whose name should be unique.
<reference name="product.info">
 <block type="xxx/yyyy" name="xxx.content" as="" template="xxx/xxx.phtml" />
 </reference>
xxx.content is block name ,it is unique.
Then ,call this block using below code in phtml of reference block
$this->getChildHtml('blockname');
As i define block name is xxx.content 
then echo $this->getChildHtml('xxx.content'); in view.phtml file As catalog/product/view.phtml is reference phtml file
- 
 I dont want to add any code in phtml file. Please see my questionVijayS91– VijayS912014年07月22日 12:30:57 +00:00Commented Jul 22, 2014 at 12:30
- 
 Vijay,could not clearly in understrand "some content in product description page".Can you explain2014年07月22日 12:35:29 +00:00Commented Jul 22, 2014 at 12:35
- 
 its may be a Html design, or contentVijayS91– VijayS912014年07月22日 12:37:46 +00:00Commented Jul 22, 2014 at 12:37