[How-To] Contact Form - Confirm Email Field Added
Posted: Sat Aug 13, 2011 5:08 am
Hi everyone i thought i would post that i have added a new field called Confirm Email so if they put an email in Email field but they put the wrong email in confirm email it will say something like "Doesnt Match" i am using Jquery for this
.
EDIT: OOPS forgot to add attachments
so here they are at bottomof post
Also i have only tested this on OC 1.5.1.1 but i believe should work on all the 1.5 releases or even below but it hasnt been tested so you could download something called Winmerge and compare the files to see if matches or what changes need to be made.
So here we go
Step 1: EDIT: catalog/controller/information/contact.php
Find: then
Add After:
Then find:
Add After:
Find:
Add After:
Find:
Add After:
Now Edit: catalog/language/english/information/contact.php
Find:
Add After: $_['text_confirm_email'] = 'Confirm E-Mail:';
Find:
Add After:
Find:
Add After:
Edit: catalog/view/theme/default/template/information/contact.tpl
Find:
Replace with:
Find: add id to it so looks like:
Add After:
Find:
Add After:
Find:
Add After:
Please find attached the two .js files and upload them to catalog/view/javascript/ also the file validation.js as all the information into it to add all the the same sort of styles for Name, Enquiry and even adding Subject and Phone. all you do is repeat the above steps but change to subject or phone etc. If you want me to post a full tutorial on adding all these please ask 
If this doesn't work for you please let me know
EDIT: i will also try and post a VQmod of this so its easier and quicker for people just need to get used to it first lol
Kind Regards,
Aaron

EDIT: OOPS forgot to add attachments

Also i have only tested this on OC 1.5.1.1 but i believe should work on all the 1.5 releases or even below but it hasnt been tested so you could download something called Winmerge and compare the files to see if matches or what changes need to be made.
So here we go

Step 1: EDIT: catalog/controller/information/contact.php
Find:
Code: Select all
$this->data['entry_email'] = $this->language->get('entry_email');
Add After:
Code: Select all
$this->data['entry_confirm_email'] = $this->language->get('entry_confirm_email');
Code: Select all
if (isset($this->error['email'])) {
$this->data['error_email'] = $this->error['email'];
} else {
$this->data['error_email'] = '';
}
Code: Select all
if (isset($this->error['confirm_email'])) {
$this->data['error_confirm_email'] = $this->error['confirm_email'];
} else {
$this->data['error_confirm_email'] = '';
}
Code: Select all
if (isset($this->request->post['email'])) {
$this->data['email'] = $this->request->post['email'];
} else {
$this->data['email'] = '';
}
Code: Select all
if (isset($this->request->post['confirm_email'])) {
$this->data['confirm_email'] = $this->request->post['confirm_email'];
} else {
$this->data['confirm_email'] = '';
}
Code: Select all
if (!preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['email'])) {
$this->error['email'] = $this->language->get('error_email');
}
Code: Select all
if (!preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['confirm_email'])) {
$this->error['confirm_email'] = $this->language->get('error_confirm_email');
}
if ($this->request->post['confirm_email']!=$this->request->post['email']) {
$this->error['confirm_email'] = $this->language->get('error_format_confirm_email');
}
Find:
Code: Select all
$_['text_email'] = 'E-Mail:';
Find:
Code: Select all
$_['entry_email'] = 'E-Mail Address:<span class="required">*</span>';
Code: Select all
$_['entry_confirm_email'] = 'Confirm E-Mail Address:<span class="required">*</span>';
Code: Select all
$_['error_email'] = 'E-Mail Address not in valid format!';
Code: Select all
$_['error_confirm_email'] = 'E-mail Address not in valid format!';
$_['error_format_confirm_email'] = 'E-mail Address does not match!';
Find:
Code: Select all
<b><?php echo $entry_email; ?></b><br />
Code: Select all
<label for="email"><?php echo $entry_email; ?></label><br />
Code: Select all
<input name="email" type="text" value="<?php echo $email; ?>" />
Code: Select all
<input id="email" name="email" type="text" value="<?php echo $email; ?>" />
Code: Select all
<span id="emailInfo">Valid E-mail please, you will need it to progress</span>
Code: Select all
<?php if ($error_email) { ?>
<span class="error"><?php echo $error_email; ?></span>
<?php } ?>
<br />
Code: Select all
<label for="confirm_email"><?php echo $entry_confirm_email; ?></label><br />
<input id="confirm_email" name="confirm_email" type="text" value="<?php echo $confirm_email; ?>" />
<span id="confirm_emailInfo">Confirm Email Address</span>
<br />
<?php if ($error_confirm_email) { ?>
<span class="error"><?php echo $error_confirm_email; ?></span>
<?php } ?>
Code: Select all
<?php echo $content_bottom; ?></div>
Code: Select all
<script type="text/javascript" src="catalog/view/javascript/jquery.js"></script>
<script type="text/javascript" src="catalog/view/javascript/validation.js"></script>

If this doesn't work for you please let me know

EDIT: i will also try and post a VQmod of this so its easier and quicker for people just need to get used to it first lol
Kind Regards,
Aaron