Edit/Remove Contact Us page in Magento

Article ID #1213
Revision: 1.3
Last update: 2012-01-05

Link to Contact Us page

By default, link to Contact Us page is added into footer menu:

 

Removing Contact Us page and link to the page

To remove the Contact Us link and Contact Us module functionality please navigate to System > Configuration > Contacts > Contact Us page, set Enable Contact Us option to No and click on Save Config button:

 

You may need to flush Magento cache to see the changes immediately.

 

Changing the Contact Us link title / label and anchor

The easiest way to change Contact Us link label is to use Inline translation tool:

 

Editing content of Contact Us page

To edit content of Contact Us page you need to edit corresponding .phtml template file. By default, it should be in app/design/frontend/<your_theme_package>/<your_theme_name>/template/contacts/form.phtml file, where <your_theme_package> and <your_theme_name> should be replaced according to your theme. If such file does not exist in your theme, it can be copied from default location:
app/design/frontend/base/default/template/contacts/form.phtml

 

Adding new fields to Contact Us page

In the example below we add a new text input field labeled Test in Grayscale theme.

 

  • app/design/frontend/default/grayscale/template/contacts/form.phtml file does not exists by default in Grayscale theme, so we copy it from app/design/frontend/base/default/template/contacts/form.phtml
  • we would like to add new input field right below Telephone number input field, so the template file is adjusted accordingly with adding new lines right after Telephone field:
    @@ -52,6 +52,12 @@                                                                                                                                                                  
                         <input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />              
                     </div>                                                                                                                                                             
                 </li>
    +            <li>
    +                <label for="test"><?php echo Mage::helper('contacts')->__('Test') ?></label>
    +                <div class="input-box">
    +                    <input name="test" id="test" title="<?php echo Mage::helper('contacts')->__('Test') ?>" value="" class="input-text" type="text" />
    +                </div>
    +            </li>
                 <li class="wide">
                     <label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
                     <div class="input-box">
    
  • after flushing Magento cache our changes are reflected on the page:
  • to make this field to appear in transactional emails corresponding email template should be adjusted accordingly, the configuration of transactional email template is described in the next section.

Adjusting transactional email template for modified Contact Us page

  • Navigate to System > Transactional Emails page and click on the Add New Template button:
  • in Load default template section select Contact Us template and click on Load button. It will load default settings for Contact Us transactional email
  • in Template Content field add all needed data for the new input fields, as we added new Test field above, the content is adjusted accordingly:


    var data.test variable will take the value of input field with 'test' id.
  • select the email template created above at System > Configuration > Contacts > Email Options > Email template:

Now Contact Us email should include all custom input fields added in the email template.

Did this article help you solve your issue?


Average rating: 3.61 (69 votes)

completely useless 1 2 3 4 5 most valuable

Tags: ,