![]() |
If statement for "State"
Hello
I have states enabled for the USA but for other countries it displays "The selected country doesn't require 'state' field". Does any one know what the best method would be to only show the "States" field when United States is selcted as the country and not show at all, (either on registration page or invoice) when any other country is selected? I am thinking the following if statement should hide it for all countries but the United States. Code:
{if $userinfo.b_country and $userinfo.s_country eq "US"} Code that displays states drop down field Thanks in advance. |
Re: If statement for "State"
I am having problems getting this to work to show the state field for only US users, using the following code in skin1/mail/html/order_invoice.tpl
Code:
{if $userinfo.s_country eq "US"} Thanks |
Re: If statement for "State"
The problem is, when they are filling out that form, they aren't logged in, so the cart has no idea where they are from :) You would need to use Jquery or some sort of dynamic scripting to hide that row when the country field changes.
|
Re: If statement for "State"
I was also thinking that. Nothing can ever be simple I guess. To me it just does not look professional to have a big old "NONE" in the state field on the invoice for those countries that do not have states. :(
|
Re: If statement for "State"
I hear ya - if you dig in to the code I believe you could rework the if statements they use to swap from the drop -down to 'none' to hide the row completely.
|
Re: If statement for "State"
Quote:
:D |
Re: If statement for "State"
Heh...true, very true.
|
Re: If statement for "State"
I got help from the Pro's over at Qualiteam and thanks to them this now works great.
For anyone else interested in only showing the "state" field for only the US (or you could change or add any country you want). Xcart Version 4.1.10 - change the following two bits of code in skin1/mail/html/order_invoice.tpl Code:
{if $_userinfo.default_fields.b_state} Code:
{if $_userinfo.b_country eq "US"} Code:
{if $_userinfo.default_fields.s_state} Code:
{if $_userinfo.s_country eq "US"} |
All times are GMT -8. The time now is 07:53 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.