Customers ask A LOT of questions. Have you ever had someone email you with a question about a product but they didn’t tell you which one? It happens! In this post we’ll show you how to easily add a small contact form to your More Info pages which a customer can use to ask a question about that product and it will automatically insert the product details.
What It Does
This process will create a link on your product More Info pages such as “Ask A Question About This Product” which when clicked will display a contact form. See the example below for how the link can look:
Once you click the link a form will appear, prompting the customer for their name, email address, and their question:
Hidden behind the scenes is the product name, sku, and the URL of the page where the customer filled out the form. All of this information will be provided in an email to the store owner when the customer submits the form.
Once the form is submitted a basic email with all of the details is sent to the store owner. Here is a sample of what the email can look like:
From: Test Guy [mailto:firstname.lastname@example.org] Sent: Thursday, June 13, 2013 11:35 AM To: email@example.com Subject: Question about: Radio Flyer Wagon email: firstname.lastname@example.org realname: Test Guy product_name: Radio Flyer Wagon product_sku: wagon product_url: http://shopsite-demo.lexiconn.com/ask-question-sample.html question: Do you have this in Blue?
To process the form results we’re going to use formmail.php which is included with your hosting account here at LexiConn. Your account should already have formmail.php but if errors appear saying formmail.php can not be found please let us know.
On the Merchandising > Custom Templates > Includes screen, click “New Include”, enter a filename of “ask_question_form” and click Create.
Edit your new include file and replace it’s default code with the following:
Update these lines to your domain name:
<form action=”http://www.your-domain.com/scripts/formmail.php” method=”post”>
<img src=”http://www.your-domain.com/scripts/verifyimg.php” alt=”Image verification” name=”vimg” id=”vimg”>
Update this line to your email address:
<input type=”hidden” name=”recipients” value=”email@example.com”>
Update this line to your “thank you” page:
<input type=”hidden” name=”good_url” value=”http://www.your-domain.com/ask-question-thanks.html”>
(This is just a regular page on your site the customer will be forwarded to after they will out the form. You could display a “thank you” message and let the customer know you will reply to their question soon.)
Once those changes are in place the next step is to test the form. To test this on a product, before going live on all your products, make a copy of your current product template. Then in your new product template enter the following code where you want the link to appear:
[-- INCLUDE ask_question_form PROCESS --]
This will insert the include template so it will appear on your page. Assign a product or a test product to the new product template and the link should then appear. Feel free to update the code to change things such as the “Ask A Question About This Product” text or the form itself.
TIP: Be sure that you do not insert this within existing form code on the page as overlapping forms will not work. For example it needs to be outside the existing order form code on the page.
For a sample of how the form looks, we have a test copy here:
Note: Our test form will not actually submit the email, it’s only to display how the link works and what the form can look like.
That’s all there is to it! One include template with a little bit of code and you can have a small contact form for all of your products.