Add the Contact Form in Product View Page

The way to render a block in magento .phtml file

Posted on March 31, 2016 in Magento

If you want to have the content form with in a phtml page then:

  1. Add the block to the xml you want. For example, I wanted to add a request form to the product view so, I went to catalog.xml under the tag and added:
    <block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml" />

  2. Use the getChildHtml() method in your product view.phtml file
    <?php getChildHtml('contactForm')?>

comments powered by Disqus