HomeMagento® Custom Contact FormsTutorialsCreating a Pre-order / Out of Stock Pop-up Form

Creating a Pre-order / Out of Stock Pop-up Form

One of the many great possibilities of integrating Custom Contact Forms in your Magento® shop, is by creating a ‘Pre-order’ pop-up form for out of stock products on your category pages.

By modifying the product list.phtml template following the instructions below, you can replace the default ‘Out of Stock’ button on your category pages with a ‘Pre-order’ button, enabling customers to pre-order items that are sold out using a custom pop-up form.

  • Open the following file in your Magento® root directory:
    app/design/frontend/YOURPACKAGE/YOURTHEME/template/catalog/product/list.phtml
  • In this file you’ll find a list and a grid section. You’ll have to edit the two ‘out of stock’ sections, which normally look something like this:
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  • Replace these sections with the following code snippet:
<?php 
Mage::register('current_product',$_product);
$filter = Mage::getModel('widget/template_filter');
echo $filter->filter('{{widget type="plugincompany_contactforms/form_widget_view" form_id="1" show_widget_as_link="1" display_as_button="1" link_title="Pre Order" link_alignment="none"}}');
Mage::unregister('current_product',$_product); 
?>
  • The bold {{widget code}} above can be generated by adding a pop-up form widget to a CMS page or block as further explained here. Of course you can also manually edit the form_id, link_title etc. in accordance with your own preferences.
Was this article helpful to you? Yes 3 No