View Single Post
  #99  
Old 12-03-2005, 11:37 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default

Since x-cart uses different registration forms whether the customer is in the cart or not, copybilling.js needs to account for the differences.

This is what I ended up using for copybilling.js:
Code:
function InitSaveVariables_shippingC(form) { //s_title = form.s_title.value; s_title = form.s_title.selectedIndex s_firstname = form.s_firstname.value; s_lastname = form.s_lastname.value; s_address = form.s_address.value; s_address_2 = form.s_address_2.value; s_city = form.s_city.value; s_state = form.s_state.value; _s_state = document.getElementById('_s_state').value; s_country = form.s_country.value; s_zipcode = form.s_zipcode.value; } function InitSaveVariables_shipping(form) { s_address = form.s_address.value; s_address_2 = form.s_address_2.value; s_city = form.s_city.value; s_state = form.s_state.value; _s_state = document.getElementById('_s_state').value; s_country = form.s_country.value; s_zipcode = form.s_zipcode.value; } function copybillingC(form) { if (form.copyb.checked) { InitSaveVariables_shippingC(form); //form.s_title.value = form.b_title.value; form.s_title.selectedIndex = form.b_title.selectedIndex form.s_firstname.value = form.b_firstname.value; form.s_lastname.value = form.b_lastname.value; form.s_address.value = form.b_address.value; form.s_address_2.value = form.b_address_2.value; form.s_city.value = form.b_city.value; change_states(document.getElementById('s_country'), 's_state', 'State/Province', '', '', '', ''); form.s_state.value = form.b_state.value; document.getElementById('_s_state').value = document.getElementById('_b_state').value; form.s_country.value = form.b_country.value; form.s_zipcode.value = form.b_zipcode.value; } else { //form.s_title.value = s_title; form.s_title.selectedIndex = s_title; form.s_firstname.value = s_firstname; form.s_lastname.value = s_lastname; form.s_address.value = s_address; form.s_address_2.value = s_address_2; form.s_city.value = s_city; change_states(document.getElementById('s_country'), 's_state', 'State/Province', '', '', '', ''); form.s_state.value = s_state; document.getElementById('_s_state').value = _s_state; form.s_country.value = s_country; form.s_zipcode.value = s_zipcode; } } function copybilling(form) { if (form.copyb.checked) { InitSaveVariables_shipping(form); form.s_address.value = form.b_address.value; form.s_address_2.value = form.b_address_2.value; form.s_city.value = form.b_city.value; change_states(document.getElementById('s_country'), 's_state', 'State/Province', '', '', '', ''); form.s_state.value = form.b_state.value; document.getElementById('_s_state').value = document.getElementById('_b_state').value; form.s_country.value = form.b_country.value; form.s_zipcode.value = form.b_zipcode.value; } else { form.s_address.value = s_address; form.s_address_2.value = s_address_2; form.s_city.value = s_city; change_states(document.getElementById('s_country'), 's_state', 'State/Province', '', '', '', ''); form.s_state.value = s_state; document.getElementById('_s_state').value = _s_state; form.s_country.value = s_country; form.s_zipcode.value = s_zipcode; } }

Then I used the following in main/register_shipping_address:
Code:
{* ======== COPY BILLING TO SHIPPING MOD ======= *} {if $js_enabled} <TR> <TD align="right"></TD> <TD></TD> <TD nowrap><input type="checkbox" name="copyb" onclick="copybilling(this.form);">Use {$lng.lbl_billing_address} as {$lng.lbl_shipping_address} </TD> </TR> {/if} {* ======== COPY BILLING TO SHIPPING MOD ======= *} {elseif $action eq "cart"} {* ======== COPY BILLING TO SHIPPING MOD ======= *} {if $js_enabled} <TR> <TD align="right"></TD> <TD></TD> <TD nowrap> <input type="checkbox" name="copyb" onclick="copybillingC(this.form);">Use {$lng.lbl_billing_address} as {$lng.lbl_shipping_address} </TD> </TR> {/if} {* ======== COPY BILLING TO SHIPPING MOD ======= *}

And I use the following in main/register_billing_address.tpl:
Code:
{* ======== COPY NAMES TO BILLING MOD ======= *} {if $js_enabled} <TR> <TD align="right"></TD> <TD></TD> <TD nowrap> <input type="checkbox" name="copyn" onclick="copynames(this.form);">Use {$lng.lbl_personal_information} in {$lng.lbl_billing_address} </TD> </TR> {/if} {* ======== COPY NAMES TO BILLING MOD ======= *}
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote