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
  #101  
Old 02-08-2006, 10:08 PM
 
mattw mattw is offline
 

Member
  
Join Date: Nov 2004
Posts: 18
 

Default

has anyone figured out how to get this mod to work with additional fields in billing/shipping info?
__________________
Matthew E Wawrzyniec
iCrunk LLC
Xcart v4.0.14
Reply With Quote
  #102  
Old 02-08-2006, 10:16 PM
  cherie's Avatar 
cherie cherie is online now
 

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

Default

Quote:
Originally Posted by mattw
has anyone figured out how to get this mod to work with additional fields in billing/shipping info?
I can't think off the top of my head why this would be a problem. Are you trying to include additional fields in what gets copied? Or are you seeing some other error?
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #103  
Old 02-08-2006, 10:25 PM
 
mattw mattw is offline
 

Member
  
Join Date: Nov 2004
Posts: 18
 

Default

im trying to include additional fields in the copy
__________________
Matthew E Wawrzyniec
iCrunk LLC
Xcart v4.0.14
Reply With Quote
  #104  
Old 02-08-2006, 10:43 PM
  cherie's Avatar 
cherie cherie is online now
 

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

Default

Quote:
Originally Posted by mattw
im trying to include additional fields in the copy
I haven't done this yet, but you should just need to add the lines to the javascript code. First find out which fields you want to copy and to where. A good way to do this is to look at the page's source code. Here are two sample methods that should both work:
Code:
// get additional fields by their id var addField2 = document.getElementById('additional_values_2') var addField3 = document.getElementById('additional_values_3') addField2.value = addField3.value
Code:
// values from numbered form elements form.elements[5].value = form.elements[6].value
The first example uses the id parameter of the input field. Mine looks like this:
Code:
<INPUT type="text" name="additional_values[2]" id="additional_values_2" size="32">
The second example gets the value by explicitly identifying which input element in the form has the value. You have to count the form elements starting with 0 to find this. It might take some trial and error and maybe using alert(form.elements[5].name) to help you identify the field you are trying to use.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #105  
Old 02-09-2006, 06:06 AM
 
mattw mattw is offline
 

Member
  
Join Date: Nov 2004
Posts: 18
 

Default

Quote:
A good way to do this is to look at the page's source code.

thank you, i dont know why i didnt think of that
__________________
Matthew E Wawrzyniec
iCrunk LLC
Xcart v4.0.14
Reply With Quote
  #106  
Old 02-09-2006, 06:49 AM
 
mattw mattw is offline
 

Member
  
Join Date: Nov 2004
Posts: 18
 

Default

so this is what i ended up with in copybilling.js
Code:
function InitSaveVariables_shipping(form){ additional_values_5 = form.additional_values_5.value; additional_values_6 = form.additional_values_6.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.additional_values_5.value = form.additional_values_2.value; form.additional_values_6.value = form.additional_values_3.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.additional_values_5.value = ""; form.additional_values_6.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 = ""; } }
__________________
Matthew E Wawrzyniec
iCrunk LLC
Xcart v4.0.14
Reply With Quote
  #107  
Old 03-10-2006, 03:55 AM
 
btomasie btomasie is offline
 

Advanced Member
  
Join Date: Oct 2004
Posts: 80
 

Default

I successfully implemented this in a 4.0.14 store that I did. But I am now doing another store, and it's in 4.0.17. I wasn't able to simply copy the same stuff over and get everything to work correctly. Having the name copied to the billing part works fine, but when I check the box to move the billing fields into the shipping fields, I get an error. It unfortunately doesn't give me much to go on, on where to troubleshoot.

So, has anyone successfully get this to work in v4.0.17 ? Or, I guess more importantly, what has changed between versions that I might be able to rework this myself?

***EDIT***
I went back into my store with Friefox and enabled the Javascript Console. It gives me a detailed error message now:

Error: document.getElementById("_s_state") has no properties
Source File: http://www.xxxxxxxxx.com/skin1/copybilling.js
Line: 10

In the copybilling.js file, this is line 10:
_s_state = document.getElementById('_s_state').value;


I have copied and pasted the javascript I am using from redlime's example.

Thanks!
Brian
__________________
X-Cart Gold v4.0.18 [unix]
- Easy Checkout module
- ezUpsell module
- CDSEO module

X-Cart Gold v4.1.11 [unix]
***38,000+ active products!
- CDSEO module
- Address Book module
- Reorder module
- Smart Search module

X-Cart Gold v4.4.2 [unix]
- in development now!
Reply With Quote
  #108  
Old 03-27-2006, 08:01 AM
 
rorktor1 rorktor1 is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 41
 

Default

Has anyone tried to get this working with the County field? Country works fine, but County is giving me problems. Not sure what to do.
__________________
X-Cart Newbie!

- X-Cart Gold v4.1.5 and v4.0.17-
Windows 2003 Server, IIS6, PHP 5.2.13
Reply With Quote
  #109  
Old 03-27-2006, 01:07 PM
 
dankind dankind is offline
 

Member
  
Join Date: Mar 2006
Posts: 16
 

Default

This mod rocks

Also can do a onblur if needed. I didn't want a check box so I removed the checkbox and ran a little onblur js function to copy each field as the user enters it...Probably not useful for most stores, but very much needed for mine
__________________
Thanx,
Dan
________________
X-Cart Gold 4.0.18
Reply With Quote
  #110  
Old 05-01-2006, 12:03 PM
 
fhiremark fhiremark is offline
 

Advanced Member
  
Join Date: Apr 2006
Location: New York
Posts: 66
 

Default

Hello, I tried to sort thru all the snippets of code to try to get this working for x-cart gold v4.0.18 but no luck.

Can somebody who's using this mod on v4.0.18 help on what needs to be done and where? Thank You.
__________________
X-cart GOLD v 4.0.18
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:34 AM.

   

 
X-Cart forums © 2001-2020