View Single Post
  #23  
Old 01-16-2005, 06:20 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

As an update to this, find the following, this works in 4.0.9 and should work in 4.0.10

In copybilling.js:
Code:
function InitSaveVariables_shipping(form){ 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 copybilling(form){ if (form.copyb.checked){ InitSaveVariables_shipping(form); form.s_firstname.value = form.firstname.value; form.s_lastname.value = form.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; form.s_country.value = form.b_country.value; form.s_zipcode.value = form.b_zipcode.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; } else { form.s_firstname.value = ""; form.s_lastname.value = ""; form.s_address.value = ""; form.s_address_2.value = ""; form.s_city.value = ""; form.s_country.value = form.b_country.value; form.s_zipcode.value = ""; change_states(document.getElementById('s_country'), 's_state', 'State/Province', '', '', '', ''); form.s_state.value = form.b_state.value; document.getElementById('_s_state').value = ""; } }

This will carry over names, address lines, states/counties depending on what you have and zip/post code. We only ship in one country so I havent tested the country drop down, but it should work ok.
Only on the checkout signup will this work for names.

On register.php this will not work, as it doesnt ask for a name.
To make it work you need PhilJ's code you need to create a second register_billing_address.tpl such as register_billing_address2.tpl which would look to copybilling2.js with PhilJ's code in.
Using the code above will leave you with JS errors on the page.

The other files are just the same, although I presonally prefer a Button to click instead of a tick box. Looks more professional.
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote