1

I want to display "fancybox" popup with a custom form and a custom action in button click. I have refered the following link: Make a Popup window showup on clicking a html link.

But where can I add the custom form content to dispaly in popup?

2
  • create a custom phtml page and write your code in it and call it from on click on button
    – BornCoder
    Jun 20, 2017 at 7:35
  • I have tried that way. But I was not able to succeed. Could you please show the code for that.I want to display the custom form in fancybox pop up
    – Vindhuja
    Jun 20, 2017 at 7:42

1 Answer 1

0

1) Create your module form then put the template form in a some phtml something like: app/design/frontend/{package}/{theme}/template/form/new-form.phtml.

2) Put this code in the <body> of the fancybox <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('form/new-form.phtml')->toHtml(); ?>

3) The fancybox you can display it where you want, in app/design/frontend/{package}/{theme}/layout/local.xml, you add this piece of code:

<your_layout_handle>
   <reference name="root">
      <block type="core/template" name="fancy.block" template="path_to_your_file.phtml"/>
   </reference>
</your_layout_handle>

then add this one in the file where your to display it:

<?php echo $this->getBlockHtml('fancy.block'); ?>

Your Answer

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

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