![]() |
register form in checkout mode - summary
There are a lot of threads regarding entering names 3 times in the checkout register form. The main one has over 3500 views and 6 pages of discussion. If like me you find this confusing and you need a fix for standard 4.0.13 that covers most requirements, then hopefully this will help. (If you are an administrator and I have started a new topic when I shouldn't, sorry, just trying to make a complicated problem to solve via the forum simpler.)
The main thread (http://forum.x-cart.com/viewtopic.php?t=17146&highlight=profile) branches off to solve the problem for version 3, then for Jon's EzCheckout, making it hard to follow and implement a standard fix. This post:
When customer starts the form, enters First and last name; these are duplicated to Billing Address (but not to Shipping) Fills in the rest of Billing Address. Click the check box to duplicate name and address to Shipping. Includes County/State and Country. Doesn't matter if fields are mandatory, as they will get filled in one way or the other, but doesn't remove them as they may well be needed. 1) Open main/register_personal_info.tpl Find INPUT fields for firstname and lastname ADD THIS CODE to end of tag onChange="populateProfile()" e.g. <INPUT type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname}" onChange="populateProfile()"> 2) Open main/register_billing_address.tpl After the last </TR> add this code {* ======== COPY BILLING TO SHIPPING MOD ======= *} {if $action eq "cart"} <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> {/if} {* ======== COPY BILLING TO SHIPPING MOD ======= *} 3) in skin1, make copybilling.js 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 = ""; } } 4) Open common_js.tpl Add this function function populateProfile() { document.registerform.s_firstname.value = document.registerform.firstname.value; document.registerform.s_lastname.value = document.registerform.lastname.value; document.registerform.b_firstname.value = document.registerform.firstname.value; document.registerform.b_lastname.value = document.registerform.lastname.value } 5)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> Have basically taken work done by these people and put it all together in something that works for me; hopefully someone else can make use of it... Credits: Bob: bobcc99 http://forum.x-cart.com/viewtopic.php?t=17146&highlight=profile PhilJ CC Bradc |
Worked great!! Thanks :D
|
pauldodman
Thanks for summarizing and posting your very helpful method for trimming down the number of times a customer has to enter their name etc. I did have trouble keeping the First and Last name manditory as it appears something fails to be filled and i get an error message that not all fields are filled when clicking submit button. www.winterdrive.com Cheers! Sam |
Hi,
It seems you also have a javascript error on the page. As you don't have all the sections on the page, ie the first section is missing, it is possible that by removing it from the template, you are only removing the display but not the checking that everything has been filled in. So you are possibly checking for fields that although not displayed are still there. Would need to check your code to be sure, but there seem to be a few errors with what you have done. |
Nice job with putting it all in one place. One minor thing, It doesn't show the shipping name at order confirmation (last screen where you submit). It does show up on the receipt, but it might be disconcerting to the customer if they are shipping to someone else and the name doesn't show up before they finish the order. :?
|
OK, well it is late here now, so I will have a look when I get chance and let you know how to solve that.
|
Hi Dave,
Firstly, had a look at some of my sites with this mod on and they seem to be carrying the shipping info forward OK. However, was going to look at your site, but I couldn't get it to go to any of the products. Tried a few links, well I can't say it took a long time, cos I couldn't get any to go - it is still doing one now and I'm on broadband. Moving back to the original question, what payment methods are you using? Will have another look at your site tomorrow. Otherwise send me a PM or email to let me know if there is a problem and I'll wait till it is working - or let me know if you need some help with it. (Just tried again - still no go) |
county
I'm new to X-Cart, but have been reading forums - and trying to learn everything I can.
I find this mod a LOT more user-friendly, than the standard checkout. However, I NEED info on how to make it copy the COUNTY over, as well. This is due to my state (FL) having about 5 different tax rates, determined by their 'ship-to' county. Can anyone advise/update this code, and explain how I can do this? This is what I tried (but it doesn't work): --------------------------------- 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_county = form.s_county.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_county.value = form.b_county.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_county.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 = ""; } } ------------------------------------------------------- I assume either I have the wrong value, OR I need to do something within the 'change' areas? Also, (while on the County subject) I'd also like to swap the county/state to state/county on the checkout, as well. Therefore a customer wouldn't have to back-track to enter their county, above the state. I read that this is done in "register_billing_address.tpl", AND "register_shipping_address.tpl" - but ain't smart enough to figure that out, either... ;) Please HELP - as I would like to get my current site switched over to X-Cart soon. Thanks in advance, Gordon |
Hi, I am not 100% familiar with US addresses, but I thought that you either had state OR county in the address. By default you would have state in the US, and county in the UK. So I guess you must have added county somehow - perhaps turning it on through the User Profiles Option?
|
Yes, I turned it on 'county' - only for taxing reasons.
They have nothing to do with our addresses. For example, if a customer buys the item in 'county A' - but wants it shipped to 'county B' - I have to charge the 'county B' tax rate. I just need to collect the county from the customer, with the rest of their info - for tax calculation only. All of my taxes are set up, and appear to work fine. - So taxes, or addresses aren't the issue. The problem I'm facing is that this particular mod won't pass the county field into the ship-to-address, when the box is checked. - thus, not being able to complete the sale - untill the customer changes it manually. It should be a simple fix, but - as I said, I'm probably too stupid... ;) Thanks, Gordon |
Just noticing that you are using v 11, although the mod was put together for 13, it should still work. Are you planning on upgrading to 17 at all? 11 was full of bugs and 17 has improved this feature anyway, you don't need to fill it in - just leave it blank.
If you are going to do this, then you would save time trying to solve this. |
I am using 17...
Sorry. I thought I changed it in my profile before posting this question. I guess it didn't stick. I know you can leave the ship-to blank - but though this 'check box' mod would make it look better.... |
It's kind of redundant in 17, you don't want people to have more clicks - less is best, gets them to the end quicker and then you get paid! No point adding things just to make it look cool - you have to think of the overall goal.
It's up to you though, if you want to try and solve it we can. |
OK.. you've talked me out of it... I did use part of the mod to copy the name down though.
I'd still like to figure out how to have it ask for the county AFTER the state in the checkout though... It looks kinda funny asking for it before.... Anyone done this yet? Thanks |
I was able to switch around the State and County order, but am still working on how to get the county field to show only when there are counties configured for that state.
So here's what you have to do. Go into /main/register_billing_address.tpl and find this code: Code:
{if $default_fields.b_county.avail eq 'Y' and $config.General.use_counties eq "Y"} Move it so it's underneath the state block of code: Code:
{if $default_fields.b_state.avail eq 'Y'} Do the same thing for /main/register_shipping_address.tpl. |
Thanks, but that didn't work for me....
Is there anywhere else that we need to change the County/State order, to make this work? My site looks rather confusing to the customer on the checkout page. I WISH I could fix it... Any other ideas? BTW, your plan on making the County field only show up for states with county assigned sounds REAL good! Let me know if you get that working... Thanks Gordon |
I'm trying to remember what exactly I did to make that change. I believe that was it. Make sure you're moving the code to the correct spot because there's 2 "blocks" of code for the state. You should be moving the county code under this line:
Code:
{if ($reg_error ne "" and $userinfo.s_state eq "" and $default_fields.s_state.required eq 'Y') or $error eq "s_statecode"}<FONT class="Star"><<</FONT>{/if} Ah, just found this one. Check out /main/register_states.tpl. |
Re: register form in checkout mode - summary
Quote:
Hi, i think the way you solve this problem is a bit complicate. Why not just do this. 1. open include/register.php find Code:
if ($action == 'cart') { Code:
if (empty($b_firstname) && $default_fields['firstname']['avail'] == 'Y') { 2. open skin1/main/register_billing_address.tpl find Code:
{if $default_fields.title.avail eq 'Y'} replace with Code:
<INPUT type="hidden" name="b_title" value="{$name_titles[title]}"> done... |
Thanks for sharing this code ajj!
Has anybody tried this and are there any other issues? |
the code works up to the point where you hit the "Submit" button, at which point it give me errors about required fields....
any fix for this? |
Re: register form in checkout mode - summary
HI
Am I correct in thinking that version 4.1.6 takes care of all this now? I have just installed it and it seems that the name etc is only asked for once, with a button to use a different shipping address. achintya X-Cart Gold |
Re: register form in checkout mode - summary
Did anyone figure out how to copy the county field?
|
Re: register form in checkout mode - summary
nice one paul works a treat.
|
All times are GMT -8. The time now is 11:54 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.