0

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?

New contributor
Rannye Rodrigues is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1

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');
0
  1. app/design/frontend/{package}/{themename}/template/catalog/product/view/form /my_custom_form.phtml

    //your form content here
    
  2. 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>
    
  3. app/design/frontend/{package}/{themename}/template/catalog/product/view.phtml

    <?php echo $this->getBlockHtml("my.custom.form"); ?>
    

Your Answer

Rannye Rodrigues is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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