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
  #21  
Old 01-10-2005, 04:25 AM
 
SMDStudios SMDStudios is offline
 

eXpert
  
Join Date: Dec 2003
Location: Orlando, FL
Posts: 207
 

Default

This appears not necessary for the 4.0.x versions??? Or is this mod just for the thrill of having the info actually populate into the fields?
__________________
X-Cart Gold various versions
Tahoe Web Design

WebsiteCM.com - We recommend WebsiteCM
Reply With Quote
  #22  
Old 01-10-2005, 04:30 AM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 178
 

Default

I don't use 4.0x, and I would prefer to have the info populate.
__________________
X-Cart version 4.7.12
Reply With Quote
  #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
  #24  
Old 01-16-2005, 06:25 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

I should add, the First name and Last name needs to be removed from the Billling Address info in XC IMO.

I havent got around to removing them yet, but it is stupid that a new customer has to give 3 names on checkout! Thats 6 boxes they have to fill in just to give names.

This IMO is silly as a lot of customers leave sites based on complicated signup forms, this not only looks complicated, it is totally unnecessary.

Not to mention this is open to a security risk or easy mistakes for new customers on signup.

Anyway, cant say too much as that is way off topic.
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #25  
Old 01-17-2005, 08:00 AM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 178
 

Default

Thanks for posting the revised code.

Unfortunately, this still does not seem to be working for me.... I am using version 3.x of x-cart, not 4.x Does anyone have any idea whether that might be the cause, and where I would look to see about changing the .js file to fix this for the older version?

The problem I'm having is that I get an error in IE, and when I check the box, it does not populate the new fields. The error I get is:

Code:
Line: 9 Char: 1 Error: Object required Code: 0


Thanks in advance--I really want to get this working. It's a GREAT mod!
__________________
X-Cart version 4.7.12
Reply With Quote
  #26  
Old 01-17-2005, 09:58 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default

Looks like your fields are named differently to the 4.0.x fields.

If you look in the copybilling.js code it is pretty straight forward.
Look to see what your fields are call in 3.x and then match them up the this code.
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #27  
Old 01-17-2005, 10:20 AM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 178
 

Default

I looked in 3.x and the fields appear to be the same.
__________________
X-Cart version 4.7.12
Reply With Quote
  #28  
Old 01-17-2005, 10:31 AM
  CC's Avatar 
CC CC is offline
 

eXpert
  
Join Date: Jun 2004
Posts: 349
 

Default



I'll take a look shortly...
__________________
XC 4.2 inc (unofficial) patch release.
Reply With Quote
  #29  
Old 01-17-2005, 11:17 AM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 178
 

Default

I hugely appreciate it. I should say that address_2 in our cart is address2, which I changed in copybilling.js. It fixed an earlier error, but produced the "object required" error in the earlier post.
__________________
X-Cart version 4.7.12
Reply With Quote
  #30  
Old 01-17-2005, 08:29 PM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 178
 

Default

Update: I've figured out where the problem is, but can't seem to get it fixed.

There are two problems; one I have figured out. The firstname/lastname needed to be "b_firstname" and "b_lastname"...easy.

It also appears that it is the "state" code that is causing a problem. If I remove all of the state code from copybilling.js, it works fine, but of course does not copy the state over. I'm wondering whether 3.x handles the state selection differently than 4.x. Here is my states.tpl file:

Code:
{* $Id: states.tpl,v 1.1.4.3 2004/04/09 07:07:28 svowl Exp $ *} {if $states ne ""} <select name="{$name}" {$style}> {* <option value="XX">Please Select Below</option> *} {section name=state_idx loop=$states} <option value="{$states[state_idx].state_code}"{if $default eq $states[state_idx].state_code and $default_country eq $states[state_idx].country_code} selected{/if}>{$states[state_idx].state}</option> {/section} </select> {else} <input type=text size=32 name="{$name}" value="{$default}"> {/if}

Here's the relevant part of register_billing_address.tpl:

Code:
<tr valign=middle> <td align=right>{$lng.lbl_state}</td> <td>{if $states ne ""}<font class=Star>*</font>{/if}</td> <td nowrap> {include file="main/states.tpl" states=$states name="b_state" default=$userinfo.b_state default_country=$userinfo.b_country} </td> </tr>

Any thoughts would be greatly appreciated.
__________________
X-Cart version 4.7.12
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 12:24 PM.

   

 
X-Cart forums © 2001-2020