How would I go about creating a simple popup from a 'view.phtml' on a product page that would popup 'form.phtml' from template/contacts.

I am trying to create a free quote button on a product page, so I would like the the form to have the basic contact form, but also have the submit email the address link that the user was left off on, or the product image.

Is this easily done? or is there a paid solution somewhere?


  • you need the contact form in popup and need to send email right? Jun 18, 2015 at 16:00
  • @saravanavelu yes this would be what im looking for. Jun 18, 2015 at 16:03
  • Try the jQuery fancy box plugin for popup Jun 18, 2015 at 16:06
  • is that not for images only? Jun 18, 2015 at 16:38
  • with that you can load the content also Jun 18, 2015 at 17:16

2 Answers 2


You'll need a custom module but it does not take much work if you know some basics of module development:

  1. create a controller action that does nothing more than

  2. Create a layout handle for this controller and include the predefined page_empty layout handle (this removes header, footer and sidebars, using page/empty.html as root template). Also add the contact form block via layout:

            <update handle="page_empty"/>
            <reference name="content">
                <block type="core/template" name="contactForm" template="contacts/form.phtml"/>
  3. if you want to prefill the contact form text area, you'll have to use an adjusted contacts/form.phtml which takes a parameter for the default value of the text area. Copy contacts/form.phtml to sth. like mycontact/form.phtml (change the template path in the layout XML accordingly), and change this line

    <textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>


    <textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"><?php echo $this->escapeHtml($this->getMessage()) ?></textarea>

    Then add this line to your controller action:

  4. Finally, create a link to open the popup in your product/view.phtml:

    $popupMessage = "This message will be prefilled in the popup contact form.\n";
    $popupMessage.= "You can add the product URL or anything else here:\n";
    $popupMessage.= $this->getProduct()->getUrl();
    <a href="javascript:popWin('<?php echo $this->quoteEscape($this->getUrl('your/controller/action', array('message' => $popupMessage)))); ?>', 'contact')">Popup</a>

You need to create pop yourself .I will give you how to call contacts us form at product view page by below code

<?php   $this->getLayout()->getCreateBlock('catalog/product_view')
->setFormAction( Mage::getUrl('cotacts/index/post') )->setTemplate('contacts/productform.phtml')->toHtml(); ?>

Here I create a template file productform.phtml which is replicate of default contacts>form.phtml file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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