I thought about this whole first name/last name thing a bit more and decided that there may well be times when the billing and shipping names are different to the original registered names. My theory being that I sometimes use my other halfs card to purchase online and if I was sending it to someone else as a present then that would be three sets of names.
Anyway I decided to keep the names fields visible but implement an additional checkbox for the name copying that copies the title, first and last names from personal info into billing and shipping info. Taking out the names copying lines in the original copybilling script and adding this copyname script instead.
Code:
function InitSaveVariables_name(form){
title = form.title.options[form.title.options.selectedIndex].value;
firstname = form.firstname.value;
lastname = form.lastname.value;
}
function copyname(form){
if (form.copyn.checked){
InitSaveVariables_name(form);
form.b_title.options.selectedIndex = form.title.options.selectedIndex;
form.b_firstname.value = firstname;
form.b_lastname.value = lastname;
form.s_title.options.selectedIndex = form.title.options.selectedIndex;
form.s_firstname.value = firstname;
form.s_lastname.value = lastname;
}
else {
form.b_title.options.selectedIndex = 0;
form.s_title.options.selectedIndex = 0;
form.b_firstname.value = "";
form.b_lastname.value = "";
form.s_firstname.value = "";
form.s_lastname.value = "";
}
}
The script is used in exactly the same way as the original copybilling so you need to add a checkbox called 'copyn' and call the javascript 'copyname.js' in the home.tpl as described previously in this post.
Hope that helps someone else.
Nicki