For a little more explicite directions, for those of us "code challenged", along with the two code updates above from Boomer (call them step 1 and step 2), do this to make the gift certificate email validation operational also:
Step 3: create a new file called [cart directory]/skin1/check_gcemail_script.tpl with contents:
Code:
{* $Id: check_gcemail_script.tpl,v 1.6.2.2 2004/03/26 09:47:33 svowl Exp $ *}
{literal}
<script language="JavaScript1.2">
function checkGCEmailAddress(field) {
var goodEmail = field.value.search(/^[A-Za-z0-9]{1}([A-Za-z0-9_\-\.]+)[^\.]\@[^\.]([A-Za-z0-9_\-\.]+\.)+[A-Za-z]{2,6}[ ]*$/gi);
if (goodEmail!=-1) {
if(field.value==document.gccreate.emailtwo.value) {
return true;
} else {
alert("Email's do not match, please correct!");
document.gccreate.emailtwo.focus();
document.gccreate.emailtwo.select();
return false;
}
} else {
{/literal}
alert("{$lng.txt_email_invalid|replace:"\n":" "|replace:"\r":" "}");
{literal}
field.focus();
field.select();
return false;
}
}
</script>
{/literal}
Step 4: in the file [cart directory]/skin1/modules/Gift_Certificates/giftcert.tpl
changed include on line 3 to call my new file for giftcert email validation:
replace:
Code:
{include file="check_email_script.tpl"}
with:
Code:
{include file="check_gcemail_script.tpl"}
around line 29, to call the new function created in Step 3 above:
replace:
Code:
if ((document.gccreate.send_via[0].checked) && (!checkEmailAddress(document.gccreate.recipient_email)))
with:
Code:
if ((document.gccreate.send_via[0].checked) && (!checkGCEmailAddress(document.gccreate.recipient_email)))
around line 203, ADD the second email field to the gift certificate purchase form, with a few changes from the one in the registration form:
Code:
<tr>
<td nowrap align=right>Validate {$lng.lbl_email}</td>
<td><font class=Star>*</font></td>
<td nowrap>
<input type=text name=emailtwo size=32 maxlength=128 value="{$giftcert.recipient_email}">
</td>
</tr>
Please Note that I have not thoroughly tested everything. The contact us form still works fine, gift cert purchase works fine, registration (thanks Boomer) works fine. Please post here if you find other problems.
Jean