Jump to content

County instead of State


jka

Recommended Posts

I noticed this in "Store Settings" after upgrade from 6.0.11 to 6.1.4., the field for State is labeled as County and it would only accept a value of 14 (CT). I just got feedback from a customer, that he had issues trying to fill out the address on the checkout page. The site was asking him for County name and wouldnt accept MA for state. He then typed it in fully and then it was tripping on "Country" needed.  Any idea how I can get this "county" vs "State" issue resolved? 

Any others experience the same issue after upgrade?

Thanks.

I just tried to recreate this issue. I was able to do it when the user tries to create an account.  This is ok when the create account was unchecked. Happens during create account. 

The following errors were detected:

  • We seem to have a problem with your address ("Default Billing Address"). Please check the value for "County" before proceeding.
Link to comment
Share on other sites

Please remind us what language you have set as default for your store (if you are expecting "State", then it must be US English).

Then, for you as the person browsing the storefront, what language are you using? (if you are expecting "State", then it must be US English)

If, on the checkout screen where a ghost customer enters their billing and delivery details, the "Country" and "State" are not drop-down selectors, then javascript has crashed, or the Smarty template variable VAL_JSON_STATE did not get populated. (Have your browser show you the HTML source it is showing and find that <script> code.)

Link to comment
Share on other sites

Please enable CubeCart's debug (Store Settings, Advanced tab, and add your IP address in the associated field (www.whatismyip.com).

Then, when viewing the General tab, scroll to the bottom and look for:

__admin

  'user_language' => xx-XX

If that does not say en-US, then view your personal Admin profile. Check your profile's Default Language.

Even so, "County" (should be "State") should be a drop-down. That it is not, suggests either javascript has crashed, or the Smarty variable is not getting populated.

Link to comment
Share on other sites

Will check that now. Also I was looking under the languages for US English. I found the error message at the top of this thread is for "check_state". This means check_state fails for abbreviation entry.

OK. You were correct and always. 

The administrator language was set to UK English and its fixed now. However I still see the State as "14" and not the abbreviation.

 

Screen Shot 2017-02-04 at 11.15.23 PM.png

Link to comment
Share on other sites

So, the experience in the Admin Panel is the same on the store front. 

For the Billing Address, the value that it accepts for State is "12" or "California". It does not accept "CA" as a value.

Not sure how after the upgrade the State became a numeric value for user entry.

Link to comment
Share on other sites

Even so, "State" should be a drop-down. That it is not, suggests either javascript has crashed, or the Smarty variable is not getting populated.

Have the browser show you the HTML source of the page it is showing. Near the bottom (not including the debug section) you should find:

<script type="text/javascript">
    var county_list = {"036":[{"id":"0","name":"-- Please Select --"}, and much follows

 

Link to comment
Share on other sites

Hello Bsmither,

     <div class="row">
         <div class="small-12 large-8 columns"><label for="addr_postcode" class="show-for-medium-up">Zip Code</label><input type="text" name="billing[postcode]" id="addr_postcode"  class="uppercase required" value="" placeholder="Zip Code (Required)" autocomplete="postal-code"></div>
      </div>
      <div class="row">
         <div class="small-12 large-8 columns"><label for="country-list" class="show-for-medium-up">Country</label>
            <select name="billing[country]" class="nosubmit" rel="state-list" id="country-list" autocomplete="country-name">
                        <option value="004" >Afghanistan</option>
                        <option value="008" >Albania</option>
                        <option value="012" >Algeria</option>
                        <option value="016" >American Samoa</option>
 ............... 
            </select>
         </div>
      </div>
      <div class="row">
         <div class="small-12 large-8 columns"><label for="state-list" class="show-for-medium-up">State</label><input type="text" name="billing[state]" id="state-list"  required value="" autocomplete="address-line1"></div>
      </div>
</div>
</address>

Link to comment
Share on other sites

So, of all the pages we have looked at, the Smarty variables 'VAL_JSON_COUNTY', 'VAL_JSON_STATE', and 'STATE_JSON' are not getting populated.

They all use a function in /includes/functions.inc.php. That function is state_json().

This function will cache the results of having built the json array. So let's check there first. In the /cache/ folder, look for a file named: hash.json.states.cache. There should be three lines of data with the third line being approx 11,500 characters long.

If this is not the case, then delete this cache file and CubeCart will rebuild it.

If this cache file is still missing all this data after being rebuilt, then the function is not getting proper data from the database. In admin, Countries/Zones, make sure United States is in the list.

Link to comment
Share on other sites

I just emptied the cache and now I am able to see hash.json.states.cache

The contents are 

a:2:{s:4:"time";i:1486315684;s:6:"expire";i:86400;}
-- CubeCart Cache Split --
b:0;

I also checked United States is in the list under Countries/Zones

Ok. I think I found the problem. I noticed that some of the Zones had strange characters in their label. For example Zurich has a ? as Z?rich. There were a total of 6 zones that had these characters. Once I fixed them, I cleared cache and now everything appears ok including a drop down list for state.

Looks like some db glitch or otherwise might have caused it. 

 

Thanks as always BSmither for pointing in the right direction.

Link to comment
Share on other sites

Now that STATE displays properly for all countries, I am wondering if there is a broader "STATE" list for all countries in world. Atleast the major ones. like Japan, Italy etc..

Also is there a possibility to Default in the Country drop down list to start with USA, UK, etc and then the whole list of rest of the world?

Thanks.

Link to comment
Share on other sites

If "Zurich" appeared as Z?rich instead of Zürich, then some part of an upgrade did not get the database configured to UTF-8 (Charset: utf8, Collation: utf8_unicode_ci) or the data re-written as UTF-8.

PHP's json_encode() function requires string data to be proper UTF-8. The ? would imply that the 'ü' was coming from a data store that allowed for this character in a character set other than UTF-8.

Thus, json_encode failed and returned a boolean false ("b:0;").

The Country drop-down could be tweaked to show the country pre-selected that matches the country the store is in.

Link to comment
Share on other sites

Assuming this is part of CubeCart (as opposed to an add-on for an earlier version of CubeCart and it is coded correctly), then, when the routine that builds the Country list is testing for a match against the store's country code, it is failing.

Meaning, please check that your store's address has the correct country in admin, Store Settings, General tab.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...