I sell electronic cigarettes (www.tropicalvapors.com). New regulations are coming down that will mandate that I capture the date of birth at registration and validate that the user is over 18 years of age. I will then manually validate the entered information against third party databases with the hope of automating the process in the future. I know that the IDOLOGY integration provides this functionality but the $800 installation fee and $1500 a month minimum was way beyond my budget.
So I decided to code the data entry and the validation myself. I set up a test store, Welcome to Tropical Vapors - Test Store - Sample Slogan. I decided to use the "additional_field1" in the customer record to contain the date of birth.
I successfully implemented the data entry in the registration template and got the redisplay and entry working on the update registration template. Since I also will have to capture the DOB for existing customers I went to add the code to the single page checkout. That is where I ran into a wall.
I don't know if the variable additional_field1 is not available or I have a coding error. I contacted tech support and they pointed me to the "Guide" for the code blocks and variables for each template. The additional_field1 was NOT listed as available for single page checkout but it wasn't listed for the registration page either and I know it is available as I have successfully used it.
Here is the code I have implemented for each of the templates. I pretty much cloned how billing last name was handled in each situation. Note I have not done any of the scripting yet to validate the date syntax or determine whether they are 18 yet. I figured I would get the data entry done first.
Registration Template - works just fine
<!--START: Date of Birth Entry - Code added by Tom Crable-->
<tr>
<td align="right" class="item"><b>Birth Date (MM/DD/YYYY)</b></td>
<td><input name="additional_field1" type="text" id="additional_field1" maxlength="10" size="15" class="txtBoxStyle">
<!--START: req_DOB-->
<img src="assets/templates/common/images/error2.gif" width="12" height="12" alt="" />
<!--END: req_DOB--></td>
</tr>
<!--END: Date of Birth Entry - Code added by Tom Crable-->
Update account template - works just fine
<!--START: Date of Birth Entry - Code added by Tom Crable-->
<tr>
<td class="item" align="right">Birth Date (MM/DD/YYYY)</td>
<td class="item"><input size="10" name="additional_field1" value="[additional_field1]" class="txtBoxStyle"> </td>
</tr>
<!--END: Date of Birth Entry - Code added by Tom Crable-->
Single page checkout template - behaves as though it doesn't recognize additional_field1
<!--START: Display Enter DOB Code - Added by Tom Crable-->
<tr>
<td align="right" class="item"><b>Date of Birth (MM/DD/YYYY)]</b></td>
<td nowrap><input name="additional_field1" type="text" onChange="clearContent(this);" id="additional_field1" value="[additional_field1]" size="15" class="txtBoxStyle">
<!--START: additional_field1-->
<img src="assets/templates/common/images/error2.gif" width="12" height="12">
<!--END: additional_field1--></td>
</tr>
<!--END: Display Enter DOB Code - Added by Tom Crable-->
-------------------------------------------------------------------------
Any advise would be greatly appreciated, even if it requires a totally different approach. Thanks in advance
So I decided to code the data entry and the validation myself. I set up a test store, Welcome to Tropical Vapors - Test Store - Sample Slogan. I decided to use the "additional_field1" in the customer record to contain the date of birth.
I successfully implemented the data entry in the registration template and got the redisplay and entry working on the update registration template. Since I also will have to capture the DOB for existing customers I went to add the code to the single page checkout. That is where I ran into a wall.
I don't know if the variable additional_field1 is not available or I have a coding error. I contacted tech support and they pointed me to the "Guide" for the code blocks and variables for each template. The additional_field1 was NOT listed as available for single page checkout but it wasn't listed for the registration page either and I know it is available as I have successfully used it.
Here is the code I have implemented for each of the templates. I pretty much cloned how billing last name was handled in each situation. Note I have not done any of the scripting yet to validate the date syntax or determine whether they are 18 yet. I figured I would get the data entry done first.
Registration Template - works just fine
<!--START: Date of Birth Entry - Code added by Tom Crable-->
<tr>
<td align="right" class="item"><b>Birth Date (MM/DD/YYYY)</b></td>
<td><input name="additional_field1" type="text" id="additional_field1" maxlength="10" size="15" class="txtBoxStyle">
<!--START: req_DOB-->
<img src="assets/templates/common/images/error2.gif" width="12" height="12" alt="" />
<!--END: req_DOB--></td>
</tr>
<!--END: Date of Birth Entry - Code added by Tom Crable-->
Update account template - works just fine
<!--START: Date of Birth Entry - Code added by Tom Crable-->
<tr>
<td class="item" align="right">Birth Date (MM/DD/YYYY)</td>
<td class="item"><input size="10" name="additional_field1" value="[additional_field1]" class="txtBoxStyle"> </td>
</tr>
<!--END: Date of Birth Entry - Code added by Tom Crable-->
Single page checkout template - behaves as though it doesn't recognize additional_field1
<!--START: Display Enter DOB Code - Added by Tom Crable-->
<tr>
<td align="right" class="item"><b>Date of Birth (MM/DD/YYYY)]</b></td>
<td nowrap><input name="additional_field1" type="text" onChange="clearContent(this);" id="additional_field1" value="[additional_field1]" size="15" class="txtBoxStyle">
<!--START: additional_field1-->
<img src="assets/templates/common/images/error2.gif" width="12" height="12">
<!--END: additional_field1--></td>
</tr>
<!--END: Display Enter DOB Code - Added by Tom Crable-->
-------------------------------------------------------------------------
Any advise would be greatly appreciated, even if it requires a totally different approach. Thanks in advance
Comment