Backup files first. Code works for me in v4.0.5
I've not tested it with a drop down menu for states/counties, but it should work ok.
I use an input box for the state/county field. When I change country, it resets the state field, but I can live with that.
---------------------------
1) Create a new file in the skin1 directory called
copybilling.js
add this code:
Code:
{literal}
<script language="JavaScript1.2">
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 = form._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_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_state.value = form.b_state.value;
form._s_state.value = form._b_state.value;
form.s_country.value = form.b_country.value;
form.s_zipcode.value = form.b_zipcode.value;
}
else {
form.s_address.value = "";
form.s_address_2.value = "";
form.s_city.value = "";
form.s_state.value = form.b_state.value;
form._s_state.value = "";
form.s_country.value = form.b_country.value;
form.s_zipcode.value = "";
}
}
</script>
{/literal}
2) in skin1/customer/home.tpl
after
Code:
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">
add this code
Code:
<script language=JavaScript1.3 src="{$SkinDir}/copybilling.js"></script>
3) find skin1/main/register_billing_address.tpl
After the last </TR>
add this code
add
Code:
{* ======== COPY BILLING TO SHIPPING MOD ======= *}
<TR>
<TD align="right"></TD>
<TD></TD>
<TD nowrap>
<input type="checkbox" name="copyb" onclick=javascript:copybilling(this.form);>Use {$lng.lbl_billing_address} as {$lng.lbl_shipping_address}
</TD>
</TR>
{* ======== COPY BILLING TO SHIPPING MOD ======= *}
---------------------------
Done.
I would then change the language variable - lbl_shipping_address_registration
from
Code:
Shipping Address (leave empty if same as billing address)
to just