How to enable the default Magento contact form?

  1. System > Configuration > Contacts
  2. Click the ‘Contact Us’ section on this page. Set ‘Enable Contact Us’ to ‘Yes’
  3. Click the ‘Email Options’ section on the same page, just under it. Set the email address to which the comments should come, subject and email template.
  4. Click ‘Save Config’

How to add a custom field to the default Magento contact form?

  1. Open [magento_root]/app/design/frontend/default/default/template/contacts/form.phtml in your favorite editor
  2. Copy & paste an existing form field code on this script and rename the field to create new field. For example:
    This is the default  code in the file:

    <div class="input-box">
    <label for="email"><?php echo Mage::helper('contacts')->__('Email') ?> <span class="required">*</span></label><br />
    <input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text" />
    </div>
    <div class="clear"></div>
    <div class="input-box">
    <label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label><br />
    <input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />
    </div>

    This is how the modified code will look like:

    <div class="input-box">
    <label for="email"><?php echo Mage::helper('contacts')->__('Email') ?> <span class="required">*</span></label><br />
    <input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text" />
    </div>
    <div class="clear"></div>
    <!-- New Field Code-->
    <div class="input-box">
    <label for="website"><?php echo Mage::helper('contacts')->__('Website') ?></label><br />
    <input name="website" id="website" title="<?php echo Mage::helper('contacts')->__('Website') ?>" value="" class="input-text" type="text" />
    </div>
    <div class="clear"></div>
    <!-- End New Field Code-->
    <div class="input-box">
    <label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label><br />
    <input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />
    </div>
  3. Now go to, System > Transaction Emails.
  4. Click ‘Add New Template’
  5. In the ‘Load default template’ section, select ‘Contact Form’ template and click ‘Load Template’
  6. The template content will look like this:
    Name: {{var data.name}}
    E-mail: {{var data.email}}
    Telephone: {{var data.telephone}}
    
    Comment: {{var data.comment}}
  7. Add your new field in this content like this:
    Name: {{var data.name}}
    E-mail: {{var data.email}}
    Website: {{var data.website}}
    Telephone: {{var data.telephone}}
    
    Comment: {{var data.comment}}
  8. Enter a new ‘Template Name’ and click ‘Save template’
  9. Now go to, System > Configuration > Contacts
  10. Click the ‘Email Options’ section on this page and select the new template that you just created.
  11. Click ‘Save Config’

How to add a link to the contact form on the top menu bar?

  1. Open [magento_root]/app/design/frontend/default/default/template/catalog/navigation/top.phtml in your favorite editor
  2. After this line:
    <?php endforeach ?>

    Add a line like this:

    <li><a href="<?php echo $this->getUrl('contacts')?>"><?php echo $this->__('Contact Us') ?></a></li>
  3. Click the Magento cache; System > Cache Management

Reference links:

  1. http://www.magentocommerce.com/wiki/how_to/add_fields_to_contact_form
  2. http://www.richardcastera.com/2009/08/17/magento-add-additional-fields-to-the-contact-form/
  3. http://www.magentocommerce.com/boards/viewthread/21707/
  4. http://inchoo.net/ecommerce/magento/contact-form-in-magento/

Incoming search terms:

  • add contact us menu in magento
  • add subject in magento contact page
  • get data of multiple div in magento
  • how to add custom contact form on product page custom fild in magento

Tagged with:

Filed under: Magento eCommerce TipsMagento eCommerce Tips

Like this post? Subscribe to my RSS feed and get loads more!