Extra product tab with contact form

2016-10-14 contact, product, tab

In this guide I want to show you how easily you can create a contact form on product page. Each customer will have possibiltiy to quickly contact with you directly from product page. Contact form will send an email with title "question about: X" where X will be the product name. Whole guide is based on our extra tabs pro module, but of course you can use any other plugin that allows to create extra product tab or to add custom contents to product pages (some part of them are free like content box).

contact form on product page

 

1. Contact form inside product extra tab

Firstly, we have to prepare some datas that we will use to create such kind of contact form. We will need to get informations like (see table attached below). url to contact form page and id of contact. And that's all, the rest will be a code that we will insert into the textform in extra tabs pro module.

 

Type of data Description where to get?
url to contact form page Our contact form will send there form that customers will fill out on product page. To get the url of contact form page - just open it - and then grab the url of the page from browser's addres bar (see screenshot).
Id of contact To send email to proper contact email, we must get its ID and put into the contact form. You can get contact ID from your shop back office. It's available under customers > contacts section in your BO (see screenshot).

 

2. Create the contact form code

To create such code we will use standard html markup "form" that allows us to build forms. So, here it is. Below the code you can find informations what to change to make it work for your website with some explanations. Please follow these steps:

  1. go to shop back office
  2. go to product edit page
  3. go to "extra tabs pro" section
  4. create new tab or edit tab that exists
  5. Tab name: type there "contact form" or any other thing that will be a title of the table
  6. Tab contents: enter to the code editor tool (see screenshot) and paste code below
<form action="_____URL_TO_CONTACT_FORM_____" method="post" class="contact-form-box" enctype="multipart/form-data">
    <input type="hidden" name="id_contact" value="_____ID_OF_CONTACT_____">
    <fieldset>
    <h3 class="page-subheading">send a message</h3>
        <div class="clearfix">
            <div class="col-xs-12 col-md-3">
                <div class="form-group selector1">
                    <label for="email">Email address</label>
                    <input class="form-control grey validate" type="text" id="email" name="from" data-validate="isEmail" value="">
                </div>
                <div class="submit">
                    <button type="submit" name="submitMessage" id="submitMessage" class="button btn btn-default button-medium"><span>Send<i class="icon-chevron-right right"></i></span></button>
                </div>
            </div>
            <div class="col-xs-12 col-md-9">
                <div class="form-group">
                  <label for="message">Message</label>
    		  <textarea style="min-height:100px;" class="form-control" id="message" name="message">Question about {name}</textarea>
                </div>
            </div>
        </div>
    </fieldset>
</form>

This is the full code of contact form that you have to paste. As you can see - i highlighted two lines. Please replace variables with previously copied values of:

  1. _____URL_TO_CONTACT_FORM_____ - replace this with url to your contact form page.
  2.  _____ID_OF_CONTACT_____ - replace this with ID of your contact email 

 

3. Extra tab with contact us form

Once you will replace the variables with correct values - you can save the contents of extra tab. On your product page should appear "contact us" tab now with contact form inside. Once customer will fill out it and send - you will receive an email to selected customer's service email. 

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim