View Single Post
  #73  
Old 05-18-2005, 11:41 AM
 
r.jones r.jones is offline
 

Newbie
  
Join Date: May 2005
Posts: 5
 

Default Simplifying the Checkout Form

This is another workaround for X-Cart Gold version 4.0.13 that I am trying on a new installation (not live yet). It needs some more testing, but may help others with this problem. Perhaps this post belongs in 4.0.13 - Cannot do anonymous checkout or register. Both threads are aimed at solving the problem of entering names more than once.

Step 1:

General Settings : User Profile options

Set "First Name" and "Last Name" to Active and Required.

Step 2:

Apply this patch, http://forum.x-cart.com/download.php?id=9 which allows the ship to names to be left blank. Shoppers will see a message: Shipping Address (leave empty if same as billing address). The patch changes only a few lines in two files. The "-" (minus sign) indicates the code that is removed, and the "+" (plus sign) indicates the code that replaces it.

Step 3:

Hide the billing names by changing in register_billing_address.tpl starting at about line 28 from:

Code:
{if $default_fields.firstname.avail eq 'Y'} <TR> <TD align="right">{$lng.lbl_first_name}</TD> <TD>{if $default_fields.firstname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD> <TD nowrap> <INPUT type="text" name="b_firstname" size="32" maxlength="32" value="{$userinfo.b_firstname}"> {if $reg_error ne "" and $userinfo.b_firstname eq "" && $default_fields.firstname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if} </TD> </TR> {/if} {if $default_fields.lastname.avail eq 'Y'} <TR> <TD align="right">{$lng.lbl_last_name}</TD> <TD>{if $default_fields.lastname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD> <TD nowrap> <INPUT type="text" name="b_lastname" size="32" maxlength="32" value="{$userinfo.b_lastname}"> {if $reg_error ne "" and $userinfo.b_lastname eq "" && $default_fields.lastname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if} </TD> </TR> {/if}

to:

Code:
{if $default_fields.firstname.avail eq 'Y'} {* <TR> *} {* <TD align="right">{$lng.lbl_first_name}</TD> *} {* <TD>{if $default_fields.firstname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD> *} {* <TD nowrap> *} <INPUT type="hidden" name="b_firstname" size="32" maxlength="32" value="{$userinfo.firstname}"> {* {if $reg_error ne "" and $userinfo.b_firstname eq "" && $default_fields.firstname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if} *} {* </TD> *} {* </TR> *} {/if} {if $default_fields.lastname.avail eq 'Y'} {* <TR> *} {* <TD align="right">{$lng.lbl_last_name}</TD> *} {* <TD>{if $default_fields.lastname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD> *} {* <TD nowrap> *} <INPUT type="hidden" name="b_lastname" size="32" maxlength="32" value="{$userinfo.lastname}"> {* {if $reg_error ne "" and $userinfo.b_lastname eq "" && $default_fields.lastname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if} *} {* </TD> *} {* </TR> *} {/if}

Step 4:

Make an onBlur event to move data entered in the personal name fields to the billing fields by changing in register_personal_info.tpl starting at about line 27 from:

Code:
<INPUT type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname}"> {if $reg_error ne "" and $userinfo.firstname eq "" && $default_fields.firstname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if} </TD> </TR> {/if} {if $default_fields.lastname.avail eq 'Y'} <TR> <TD align="right">{$lng.lbl_last_name}</TD> <TD>{if $default_fields.lastname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD> <TD nowrap> <INPUT type="text" id="lastname" name="lastname" size="32" maxlength="32" value="{$userinfo.lastname}">

to:

Code:
<SCRIPT type="text/javascript"> {literal} function update_b_firstname() { document.registerform.b_firstname.value = document.registerform.firstname.value; } {/literal} </SCRIPT> <SCRIPT type="text/javascript"> {literal} function update_b_lastname() { document.registerform.b_lastname.value = document.registerform.lastname.value; } {/literal} </SCRIPT> <INPUT type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname}" onBlur="update_b_firstname()"> {if $reg_error ne "" and $userinfo.firstname eq "" && $default_fields.firstname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if} </TD> </TR> {/if} {if $default_fields.lastname.avail eq 'Y'} <TR> <TD align="right">{$lng.lbl_last_name}</TD> <TD>{if $default_fields.lastname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD> <TD nowrap> <INPUT type="text" id="lastname" name="lastname" size="32" maxlength="32" value="{$userinfo.lastname}" onBlur="update_b_lastname()">
__________________
r.jones
X-Cart Version 4.0.13
Reply With Quote