X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   country before state (https://forum.x-cart.com/showthread.php?t=11905)

cybrgman 02-02-2005 10:03 AM

country before state
 
Is it possible to move the country field above the state field when a customer is checking out ?

I've had quite a few emails from customers not figuring out they need to change the country first in order to enter their province.

I tried removing all the states which would be fine but we use flat rate shipping depending on state so removing all the states really isn't an option.

Any help would be great, thanks :)

balinor 02-02-2005 03:23 PM

Sure, just edit the main/register_billing_address.tpl and main/register_shipping_address.tpl and move the fields around however you would like.

cybrgman 02-02-2005 04:14 PM

Quote:

Originally Posted by balinor
Sure, just edit the main/register_billing_address.tpl and main/register_shipping_address.tpl and move the fields around however you would like.


Thanks for your reply balinor,

I did that but it wouldn't work for me, seems that county, state and country all tie into one another somehow.

Could you be a bit more specific maybe I did something wrong?

I've done quite a bit of moding on this site and am usually able to resolve the issue but this one has me stumped.

BTW, I have Jon's easy checkout installed on this too but that shouldn't be an issue as the mod doesn't affect the registration form.

balinor 02-02-2005 04:56 PM

There are a lot of {if} statements in there, so you have to be careful, but it is possible to move them. Did you try moving them and you got an error?

cybrgman 02-02-2005 05:15 PM

yes I did and I believe one of the {/if} is exactly what I screwed up, this is what I did.

Code:

{* $Id: register_billing_address.tpl,v 1.15.2.3 2004/10/26 13:08:43 max Exp $ *}
{if $default_fields.b_state.avail eq 'Y' && $default_fields.b_country.avail eq 'Y' && $js_enabled eq 'Y' && $config.Adaptives.isJS eq 'Y' && $config.General.use_js_states eq 'Y' && $config.Adaptives.isDOM eq 'Y'}{include file="change_states_js.tpl"}{/if}
{if $is_areas.B eq 'Y'}
{if $hide_header eq ""}
<TR>
<TD height="20" colspan="3">{$lng.lbl_billing_address}<HR size="1" noshade></TD>
</TR>
{/if}

{if $action eq "cart"}
<INPUT type="hidden" name="action" value="cart">
<INPUT type="hidden" name="paymentid" value="{$paymentid}">

{if $default_fields.title.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_title}</TD>
<TD>{if $default_fields.title.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<SELECT name="b_title">
{section name=title loop=$name_titles}
<OPTION {if $userinfo.b_title eq $name_titles[title]}selected{/if}>{$name_titles[title]}</OPTION>
{/section}
</SELECT>
</TD>
</TR>
{/if}

{if $default_fields.firstname.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_first_name}</TD>
<TD>{if $default_fields.firstname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<INPUT type="text" name="b_firstname" size="32" maxlength="32" value="{$userinfo.b_firstname}">
{if $reg_error ne "" and $userinfo.b_firstname eq "" && $default_fields.firstname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}

{if $default_fields.lastname.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_last_name}</TD>
<TD>{if $default_fields.lastname.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<INPUT type="text" name="b_lastname" size="32" maxlength="32" value="{$userinfo.b_lastname}">
{if $reg_error ne "" and $userinfo.b_lastname eq "" && $default_fields.lastname.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}
{/if}

{if $default_fields.b_address.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_address}</TD>
<TD>{if $default_fields.b_address.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<INPUT type="text" id="b_address" name="b_address" size="32" maxlength="64" value="{$userinfo.b_address}">
{if $reg_error ne "" and $userinfo.b_address eq "" and $default_fields.b_address.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}

{if $default_fields.b_address_2.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_address_2}</TD>
<TD>{if $default_fields.b_address_2.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<INPUT type="text" id="b_address_2" name="b_address_2" size="32" maxlength="64" value="{$userinfo.b_address_2}">
{if $reg_error ne "" and $userinfo.b_address_2 eq "" and $default_fields.b_address_2.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}

{if $default_fields.b_city.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_city}</TD>
<TD>{if $default_fields.b_city.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<INPUT type="text" id="b_city" name="b_city" size="32" maxlength="64" value="{$userinfo.b_city}">
{if $reg_error ne "" and $userinfo.b_city eq "" and $default_fields.b_city.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}

{if $default_fields.b_state.avail eq 'Y' && $default_fields.b_country.avail eq 'Y' && $js_enabled eq 'Y' && $config.General.use_js_states eq 'Y'}
{include file="main/register_states.tpl" state_name="b_state" country_name="b_country" country=$userinfo.b_country state=$userinfo.b_state|default:$config.General.default_state full_state=$userinfo.b_statename county_name="b_county" default_county=$userinfo.b_countyname default_countyid=$userinfo.b_county form_name="registerform" zipcode_name="b_zipcode"}
{else}
{if $default_fields.b_county.avail eq 'Y' and $config.General.use_counties eq "Y"}
<TR>
<TD align="right">{$lng.lbl_county}</TD>
<TD>{if $default_fields.b_county.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
{include file="main/counties.tpl" counties=$counties name="b_county" default=$userinfo.b_county}
{if ($reg_error ne "" and $userinfo.b_county eq "" and $default_fields.b_county.required eq 'Y') or $error eq "b_county"}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}

{if $default_fields.b_country.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_country}</TD>
<TD>{if $default_fields.b_country.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<SELECT name="b_country" id="b_country" onChange="check_zip_code()">
{section name=country_idx loop=$countries}
<OPTION value="{$countries[country_idx].country_code}"{if $userinfo.b_country eq $countries[country_idx].country_code} selected{elseif $countries[country_idx].country_code eq $config.General.default_country and $userinfo.b_country eq ""} selected{/if}>{$countries[country_idx].country}</OPTION>
{/section}
</SELECT>
{if $reg_error ne "" and $userinfo.b_country eq "" and $default_fields.b_country.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}
{/if}

{if $default_fields.b_state.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_state}</TD>
<TD>{if $default_fields.b_state.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
{include file="main/states.tpl" states=$states name="b_state" default=$userinfo.b_state default_country=$userinfo.b_country}
{if $error eq "b_statecode" and $default_fields.b_state.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}

{if $default_fields.b_zipcode.avail eq 'Y'}
<TR>
<TD align="right">{$lng.lbl_zip_code}</TD>
<TD>{if $default_fields.b_zipcode.required eq 'Y'}<FONT class="Star">*</FONT>{else}{/if}</TD>
<TD nowrap>
<INPUT type="text" id="b_zipcode" name="b_zipcode" size="32" maxlength="32" value="{$userinfo.b_zipcode}" onChange="check_zip_code()" >
{if $reg_error ne "" and $userinfo.b_zipcode eq "" and $default_fields.b_zipcode.required eq 'Y'}<FONT class="Star">&lt;&lt;</FONT>{/if}
</TD>
</TR>
{/if}
{include file="main/register_additional_info.tpl" section="B"}
{/if}


I just moved country right above state but I know thats wrong.

too many d*mn {if}'s and {/if}'s .... guess I'm getting old :)

balinor 02-02-2005 06:15 PM

I think you need to take the second closing {/if} from the country grouping, and move it below the last {/if} in the state grouping.......

mffowler 02-02-2005 06:39 PM

You have an else and an if statement ... you'll have to decide what you want to use.

- Mike

cybrgman 02-02-2005 06:41 PM

ok thanks balinor I'll give that a try in a little while once traffic slows down a bit.

I REALLY appreciate your help with this :)

cybrgman 02-02-2005 06:55 PM

Quote:

Originally Posted by mffowler
You have an else and an if statement ... you'll have to decide what you want to use.

- Mike



sorry Mike just caught your post, can you explain further ?

cybrgman 02-02-2005 07:20 PM

Ok I got it and it works :)

The only other thing I had to do was to also reverse the country and state fields in the register_states.tpl

Works like a charm :D

Thanks guys for your help .... excellent :)

echidna 06-14-2005 07:53 PM

Quote:

Originally Posted by cybrgman
Ok I got it and it works :)

The only other thing I had to do was to also reverse the country and state fields in the register_states.tpl

Works like a charm :D

Thanks guys for your help .... excellent :)


Where does register_states.tpl get rendered? I can't find it's output in the checkout process.

The state before country thing is amazingly poor design, as is the requirement to enter names repeatedly :evil:

I've got to get the checkout form reformed. Any advise would be cherished :?

Mary Jo Robins 07-08-2005 05:00 AM

please explain more
 
cybrgman

can you please explain this a little better for me :oops: ? Does this move the country before the state in the registration form?

Quote:

The only other thing I had to do was to also reverse the country and state fields in the register_states.tpl

can you show your file so that I can ensure mine is correct.

tracey_ccishop 09-28-2005 08:33 PM

I also had a similar issue and got this code back from tech support. It changes the customer registration form so that the user has to enter the country they are in first and then a drop down box appears with the list of states for that country.
Hope it helps


Please perform following steps:
>
> 1. Open '<xcart_root_dir>/skin1/main/register_states.tpl' template.
>
> 2. Replace :
>
> ---
> <SELECT name="{$country_name}" id="{$country_name}"
> onChange="check_zip_code_field(document.forms['{$form_name}'].{$country_n
> ame}, document.forms['{$form_name}'].{$zipcode_name});
> change_states(document.getElementById('{$country_n ame}'),
> '{$state_name}', '{$county_name}', '{$lng.lbl_state|replace:"'":"\'"}',
> '{$state|replace:"'":"\'"}', '{$is_no_input}',
> '{$full_state|replace:"'":"\'"}',
> '','{$userinfo.$county_name|replace:"'":"\'"}','{$ userinfo.$county_name|r
> eplace:"'":"\'"}'); change_counties('{$county_name}',
> document.getElementById('_{$state_name}'),
> document.getElementById('{$country_name}'),
> '{$userinfo.$county_name}','{$userinfo.$county_nam e}');">
> {foreach from=$countries item=v}
> <OPTION value="{$v.country_code}"{if $country eq $v.country_code}
> selected{elseif $v.country_code eq $config.General.default_country and
> $country eq ""}selected{/if}>{$v.country}</OPTION>
> {/foreach}
> </SELECT>
> ---
>
> with
>
> ---
> <SELECT name="{$country_name}" id="{$country_name}"
> onChange="check_zip_code_field(document.forms['{$form_name}'].{$country_n
> ame}, document.forms['{$form_name}'].{$zipcode_name});
> change_states(document.getElementById('{$country_n ame}'),
> '{$state_name}', '{$county_name}', '{$lng.lbl_state|replace:"'":"\'"}',
> '{$state|replace:"'":"\'"}', '{$is_no_input}',
> '{$full_state|replace:"'":"\'"}',
> '','{$userinfo.$county_name|replace:"'":"\'"}','{$ userinfo.$county_name|r
> eplace:"'":"\'"}'); change_counties('{$county_name}',
> document.getElementById('_{$state_name}'),
> document.getElementById('{$country_name}'),
> '{$userinfo.$county_name}','{$userinfo.$county_nam e}');">
> <OPTION value="" selected>Please select country...</OPTION>
>
> {foreach from=$countries item=v}
> <OPTION value="{$v.country_code}"{if $country eq $v.country_code}
> selected{/if}>{$v.country}</OPTION>
> {/foreach}
> </SELECT>
> ---
>
> After that your customers will see 'Please select country...' option in
> 'Country' drop-down box first.

dcorwin 12-01-2006 01:17 PM

Re: country before state
 
This seems to have changed in version 4.1. Any ideas how I might implement this little mod?

Thanks!


All times are GMT -8. The time now is 10:49 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.