Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

check box for "same as billing address"

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 01-17-2005, 08:40 PM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 185
 

Default

Ok--I got it. Here is the copybilling.js for 3.x...or at least this is what worked for me:

Code:
function InitSaveVariables_shipping(form){ s_firstname = form.s_firstname.value; s_lastname = form.s_lastname.value; s_company = form.s_company.value; s_address = form.s_address.value; s_address2 = form.s_address2.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.b_firstname.value; form.s_lastname.value = form.b_lastname.value; form.s_company.value = form.b_company.value; form.s_address.value = form.b_address.value; form.s_address2.value = form.b_address2.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_company.value = ""; form.s_address.value = ""; form.s_address2.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 = ""; <!-- document.getElementById('_s_state').value = ""; } }
__________________
X-Cart version 4.7.12
Reply With Quote
  #32  
Old 02-07-2005, 05:08 PM
 
CopperB CopperB is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 58
 

Default

Fist off thanks for this MOD. It is great. As stated it should be standard in Xcart.

The mod works just as it should be but I have added an " Additional " Phone field in Billing and Shipping. As this is an additional field the code is not copying the phone field. I have not been able to figure out the additional code I need to add in the copybilling.js Also if I need to change any of the code in the other templates used.

If anyone knows what I need to add/change that would be great.

Thanks
__________________
CopperB

XCart Gold -> v4.0.11
PHP -> v4.3.10
MySQL -> v4.0.22
Apache -> v1.3.33
Smarty -> v2.6.3
Reply With Quote
  #33  
Old 02-07-2005, 07:26 PM
  eaglemobiles's Avatar 
eaglemobiles eaglemobiles is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 167
 

Default

Hi,

Thanks for your great work, i am using 4.0.11
I followed all of your instructions change the last code you posted but i still getting error.

I will be grateful for help

Thanks
__________________
X-Cart Gold 4.3.2
X-Cart Gold 4.4.1
Unix

High Quality CCTV DVRs & Cameras
http://www.eaglemobiles.co.uk/CCTV
Reply With Quote
  #34  
Old 02-07-2005, 08:33 PM
 
CopperB CopperB is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 58
 

Default

1) Create a new file in the skin1 directory called copybilling.js
add this code:

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 = ""; } }

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
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 ======= *}


I have tested in Firefox 1.o and IE 6.0 and both work

Hope this helps
__________________
CopperB

XCart Gold -> v4.0.11
PHP -> v4.3.10
MySQL -> v4.0.22
Apache -> v1.3.33
Smarty -> v2.6.3
Reply With Quote
  #35  
Old 02-08-2005, 01:46 PM
 
jeremy35 jeremy35 is offline
 

Member
  
Join Date: Feb 2005
Posts: 16
 

Default

CopperB

Thanks, this worked great for me!
__________________
X-Cart Gold 4.1.9
Linux Server @ www.offbeathosting.com

Danger Den, LLC
www.dangerden.com
Water Cooling Computers!
Reply With Quote
  #36  
Old 02-08-2005, 02:08 PM
 
CopperB CopperB is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 58
 

Default

NP jeremy. Glad to hear that it worked for you.

Has anyone tried this with an " Additional " Phone field in Billing and Shipping.

As this is an additional field the code mod is not copying the phone field. I have not been able to figure out the additional code I need to add in the copybilling.js

Also if I need to change/add any of the code in the other templates used.


Thanks
__________________
CopperB

XCart Gold -> v4.0.11
PHP -> v4.3.10
MySQL -> v4.0.22
Apache -> v1.3.33
Smarty -> v2.6.3
Reply With Quote
  #37  
Old 02-08-2005, 02:20 PM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

jeremy35 you still got errors man.

Just checked it out on your site...
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #38  
Old 02-08-2005, 02:24 PM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

It would appear that some are not giving consideration to the two different registration forms.

Remeber, there is a Checkout sign up page AND and general register page.

They dont have the same sign up fields.
The general sign up page does not ask for the a Name twice, the checkout sign up does.

So on the general signup you have no name field to carry across twice, hence the error.

Either create two templates for this or use this .js code:
Code:
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 = ""; } }
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #39  
Old 02-08-2005, 03:30 PM
 
CopperB CopperB is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 58
 

Default

CC

You are right. It works on my checkout sign up but not on the general signup.


This is from a post of yours earlier in this thread.

Quote:
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.


Would you be able to post the code for those 2 new files and what other templates need modified.

Thanks
__________________
CopperB

XCart Gold -> v4.0.11
PHP -> v4.3.10
MySQL -> v4.0.22
Apache -> v1.3.33
Smarty -> v2.6.3
Reply With Quote
  #40  
Old 02-08-2005, 04:00 PM
  DogByteMan's Avatar 
DogByteMan DogByteMan is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 833
 

Default

Instructions for 4.0.x using the ezCheckout mod by jon:

In your skin1 folder create the following files

copybilling1.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 = ""; } }

copybilling2.js
Code:
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 = ""; } }

In skin1/customer/home_checkout.tpl

after
Code:
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">

add this code
Code:
<script language=JavaScript1.3 src="{$SkinDir}/copybilling1.js"></script>

In skin1/customer/home.tpl

after
Code:
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">

add this code
Code:
<script language=JavaScript1.3 src="{$SkinDir}/copybilling2.js"></script>

Find skin1/main/register_billing_address.tpl

After the last </TR>
add this code
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 ======= *}
__________________
Dedicated Server provided by EWD Hosting
X-Cart version 4.1.12
PHP 5.3.2
MySQL server 5.0.87-community
Operation system Linux
Perl 5.008008
dogbytecomputer.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:38 AM.

   

 
X-Cart forums © 2001-2020