Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How To Add Custom Field In Magento Contact Form ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.16k
    Comment on it

    In magento, sometimes you need to add custom field to existing contact form as per client requirement. Here is an easy way to customize magento form by adding new field.
    You can also add more fields as per need.

    Lets see how can we do it.

    Step 1. Edit form.phtml
    Path: app/design/frontend/default/CURRENT_THEME/template/contacts/form.phtml.

      <li>
                    <div class="field">
                           <label for="company"><?php echo Mage::helper('contacts')->__('Company') ?></label>
                           <div class="input-box">
                                 <input name="company" id="company" title="<?php echo Mage::helper('contacts')->__('Company') ?>" value="" class="input-text" type="text" />
                           </div>
                   </div>
                </li>

    Step 2. To show custom field (Company) in contact us mail.
    (a). Go to -> System -> Transactional E-mails and click Add New Template.

    (b). From the Template drop-down box Choose Contact Form option & then click on Load Template button.
    Under template content you can add your new field Company after Name : {{var data.name}} like this:

    Name: {{var data.name}}
    Name: {{var data.company}}
    Email: {{var data.email}}
    Telephone: {{var data.telephone}}
    Comment: {{var data.comment}}

    (c). Enter The Name of template & click on Save Template Button at the right top.

    Step 3. Finally, Go to System -> Configuration and click Contacts under General tab. Then Choose your new template from Email Template drop-down select box and click on Save Config button at right top.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: