Customizing Product Enquiry Forms with FormBuilder and Products Modules

Suppose you are building a catalog website in CMS Made Simple that uses the Products Module and you want to show a contact form on each product detail page. With this little trick you can customize the Subject line of the enquiry form using FormBuilder to include the Product Name automatically.

To do this, use the standard Contact Form in FormBuilder. we look up the field id of the Subject line in your Contact Form. You can do this by checking the “show field id” option in Formbuilder’s Preferences Tab.

Let’s say for example, the field number is “40”. Now, in your product detail template just put the following FormBuilder tag:

{FormBuilder form='contact' value_fld40=$entry->product_name}

This will generate a contact form where the Subject line has already been populated with the Product Name. Of course, the user can still change it. But this makes it easier for the sales staff to know what the enquiry is about.

Now, suppose you have a multi-lingual website. You can do something similar, but have a form in each language.

First create the contact form and make it just how you want it for English, including sending to the correct email address.

Next, in the main FormBuilder admin page, click the XML button to the right of the form name. It will download an XML file for this form to your downloads directory.

Now, on the same FormBuilder main page, you can use the “XML Form Import” section to import that XML file that you just saved. Import it once for each language you support, and each time name the form alias contact_ followed by the language abbreviation. Example: contact_ru for the Russian language contact form.

If you have installed the Multilanguage CMS Module, you should have the following variable set in your template: {$lang_parent}, which will hold the two-letter abbreviation of the language selected.

In your Products Detail template, change your FormBuilder tag to this:

{FormBuilder form='contact_'|cat:$lang_parent value_fld40=$entry->product_name}

We just used the SMARTY concatenate filter to attach the value of $lang_parent after contact_. So if $lang_parent is ‘ru’ for this user, it will call the form alias “contact_ru”.

In each of your language specific forms you can now change all the field labels to that language.

But now if we try it we discover that the Subject field is not being populated with the product name on the non-english product pages. The reason for this is that each time you import a form into FormBuilder with XML, it creates new id numbers for the fields. So your non-English forms don’t have a field #40. Their “subject” fields will have different field numbers.

The way I get around this problem is to look at each form and make a list of the field number for the Subject equivalent field for that language form.

Then in my FormBuilder tag I do this:

{FormBuilder form='contact_'|cat:$lang_parent
value_fld40=$entry->product_name
value_fld46=$entry->product_name
value_fld58=$entry->product_name
value_fld52=$entry->product_name
}

It doesn’t hurt the form to receive values for fields that it doesn’t have. It will just ignore the irrelevant field values.

This concludes customizing Product Enquiry Forms with FormBuilder and Products Modules

Looking for quality CMS Made Simple Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , | Posted under CMS Made Simple | RSS 2.0

Author Spotlight

Ken Griffith

Ken Griffith lives in Nairobi, Kenya and is a web developer for Cottage Networks. He uses CMS Made Simple as his preferred content management system for most web projects.

4 Comments on Customizing Product Enquiry Forms with FormBuilder and Products Modules

  1. Manuel says:

    Nice and easily usable, I keep learning! :)
    oops, I wasn’t aware of the “Passing Default Values to Forms” part in formbuilder!!!

    Greetings,
    Manuel

  2. Hello this is kind of of off topic but I was wondering if blogs
    use WYSIWYG editors or if you have to manually
    code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get advice from someone with experience. Any help would be enormously appreciated!

    • Noah S says:

      Hi, Unfortunately the blog would need to be designed to work with WYSIWYG. You can use RVSiteBuilder which comes in all Arvixe’s cPanel accounts to build a blog. We do recommend using a blog script through as you will get far more functionality out of it.

  3. Kamal Vance says:

    Being new to this field I always wanted to learn to build FormBuilder and Products modules.With the help of your tutorial I will get to learn some basics to this.

Leave a Reply

Your email address will not be published. Required fields are marked *


9 × 4 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>