In OpenCart 2.0 default Contact Us page (/index.php?route=information/contact) – Contact Form has only 3 fields: Your Name, E-Mail Address, and Enquiry

To add custom fields to Contact Form, you can

  1. Buy an extension (as of 5/9/2015, it seems that I can’t find one that modify directly Contact Us form) – UPDATE as of 4/25/2016, there are quite some extensions available.
  2. Do it yourself: To do it yourself you can follow this tutorial link or follow instructions below to add a Telephone is the form (if you want to add more fields, just add more similar codes)

To add custom Telephone field to “Contact Form” in OpenCart 2.0, you would need to edit 3 files:

  1. \catalog\language\english\information\contact.php
  2. \catalog\controller\information\contact.php
  3. \catalog\view\theme[YourThemeName]\template\information\contact.tpl

[YourThemeName] = Whatever theme that you selected for your store, default is “default” (You can verify or set it here: /Admin => Systems => Settings => Select your store and click Edit => Store tab => Default Layout)

1. Edit language file: \catalog\language\english\information\contact.php

a. Under line:

$_['entry_email']    = 'E-Mail Address';

Add code:

$_['entry_phone']     = 'Telephone';

b. Under line

$_['error_email']    = 'E-Mail Address does not appear to be valid!';

Add code:

$_['error_phone']    = 'Telephone is required!';

2. Edit control file: \catalog\controller\information\contact.php

a. Under code:

$data['entry_email'] = $this->language->get('entry_email');

Add code:

$data['entry_phone'] = $this->language->get('entry_phone');

b. Under code

if (isset($this->error['email'])) {
        $data['error_email'] = $this->error['email'];
    } else {
        $data['error_email'] = '';
    }

Add code

if (isset($this->error['phone'])) {
        $data['error_phone'] = $this->error['phone'];
    } else {
        $data['error_phone'] = '';
    }

c. Under code:

if (!preg_match('/^[^\@]+@.*.[a-z]{2,15}$/i', $this->request->post['email'])) {
        $this->error['email'] = $this->language->get('error_email');
    }

Add code:

if ((utf8_strlen($this->request->post['phone']) < 1)) {
        $this->error['phone'] = $this->language->get('error_phone');
    }

d. FIND code

$mail->setText($this->request->post['enquiry']);

UPDATE code to

$mail->setText($this->request->post['enquiry'] . $mail->newline . 'Telephone: ' . $this->request->post['phone']);

e. Under code: 1/4/2016 NEW CODES ADDED TO FIX Undefined variable: phone

if (isset($this->request->post['email'])) {
   $data['email'] = $this->request->post['email'];
} else {
   $data['email'] = $this->customer->getEmail();
}

Add code:

if (isset($this->request->post['phone'])) {
   $data['phone'] = $this->request->post['phone'];
} else {
   $data['phone'] = '';
}

3. Edit template file: \catalog\view\theme[YourThemeName]\template\information\contact.tpl

a. Under line:

Will update this section… WordPress auto remove my php codes even thought I pasted as text only or use <pre> tag still not working


After update above 3 files, just upload to your server and test. Good luck!

I posted an answer in stackoverflow site