I'm trying to do a form and put this on Product View. I did some fields and they are saving the results on DB, ok, everything is good. But, I need to insert this block there. Any thing that I help me?
2 Answers
In your theme, you should extend catalog.xml and inside him put:
<catalog_product_view>
<reference name="product.info">
<block type="<your_class_block>" name="<your_name>" template="<your_template_file>"/>
</reference>
</catalog_product_view>
But, if you don't want product.info you can add a block inside <catalog_product_view>
<catalog_product_view>
<block type="<your_class_block>"
name="<your_name>"
template="<your_template_file>"/>
</catalog_product_view>
then in your view.phtml you should put:
$this->getChildHtml('<your_name_or_alias_of_block');
app/design/frontend/{package}/{themename}/template/catalog/product/view/form /my_custom_form.phtml
//your form content here
app/design/frontend/{package}/{themename}/layout/local.xml
<catalog_product_view> <reference name="root"> <block type="core/template" name="my.custom.form" template="catalog/product/view/form/my_custom_form.phtml"/> </reference> </catalog_product_view>
app/design/frontend/{package}/{themename}/template/catalog/product/view.phtml
<?php echo $this->getBlockHtml("my.custom.form"); ?>