Jump to content

Resolved - Order of UK Zones


Recommended Posts

Does anyone know how to order the Zones in the UK?

This is a particularity of the UK, as it's made up of 4 countries. In CubeCart UK zones are listed like this:




Northern Ireland.

So when I add a zone (ie. a county), these get added at the bottom of the list, past Northern Ireland counties, and even past the bottom "Please Select".

So how do I get, for example, "West Yorkshire" in the England section of the list?

Most of my clients are in West Yorkshire, so I really have to figure this one out.

I must add -- really, CubeCart, this is version 5 -- there really should be a correct list of UK counties by now. It's been a known issue since the very beginning. Really disappointed.


Link to comment
Share on other sites

Hi and thanks for answering. The latest version I've installed for a client was 5.0.8. I've attached a screenshot -- no West Yorkshire not here, anyone know if it's definitely an update between 5.0.8 and 5.1.4?


... And then if I add the 3 Yorkshires myself, here's where they show up :(


Link to comment
Share on other sites

There have been loads of changes since 5.0.8. It looks like it won't be too long before 5.1.5 is released. After waiting some time to be sure 5.1.5 doesn't have major bugs, you would certainly benefit from upgrading, and I suspect it would solve this problem for you.

You really need to update your sig now to include your setup.

Link to comment
Share on other sites

If you try 5.1.4, be sure you look over the recent bug fixes, such as for SagePay. If you need USPS, you will have to to use By_Weight for right now, unless the file offered on the tracker works for you. There may be more there of importance.

Thanks for the sig. It will help speed up responses from those who are knowledgeable here.

Link to comment
Share on other sites

  • 1 month later...

Sadly I'm back to square one, even after upgrading to 5.1.5

Well nearly -- in fact it's even weirder than before...

Perhaps it's because I did an upgrade and not a new install -- and it remembered the previous three Yorkshires I'd added....

But they were still in the wrong place (bottom of the UK list).

When I deleted them and added them back in, North & West Yorkshire went again to the very bottom of the UK list.

But SOUTH YORKSHIRE went to between the bottom of the ENGLAND list -- above Scotland.

I'm just stumped. Surely there's got to be a file somewhere or a part of the database that allocates zones to the four countries of the UK?

I mean, how does CC5 know to put them in that geographical (and not entirely alphabetical) order in the first place?

I really do need to sort this -- my client is in West Yorkshire... they're going to notice it, and some way or another I'm going to have to fix it.

Any ideas I could try, anyone?


Link to comment
Share on other sites

Would you please try this experiment? Using a programmer's text editor:

In the file /includes/functions.inc.php, the function state_json() (at around line 751):

The line that starts with $counties = $GLOBALS['db']->query(...

At the end of that line, make it look like this:

ON gc.id=gz.country_id ORDER BY gc.name,gz.name');

The query, as it exists now, pulls records from the zone (aka county/state) table in the order they were written to the table. So adding South Yorkshire puts it at the bottom of the list - after Western Australia as far as the order of insertion in the zone table is concerned.

Next, for each zone row, the ISO Number Code for that zone's country is attached. So, again, at the bottom of the list is South Yorkshire::826.

Next, an array is built with the ISO Number Code as the key. So (along with all other zones in the 826 country), we get:

$array['826'] = array('--Please Select--', 'yada', 'yada', 'yada', 'South Yorkshire')

When the customer picks United Kingdom (826) as the country, javascript loads the county/state selector with the appropriate list. But still South Yorkshire is at the bottom. The list is still in the order of table inserts.

By adding the ORDER BY clause, we are asking for the list to be sorted by the name of the country first, then for each country, the name of the county. That means East Yorkshire, North Yorkshire, South Yorkshire, and West Yorkshire, will be correctly listed in the now alphabetical list.

Link to comment
Share on other sites

  • 2 weeks later...

Hi bsmither -- only just got to seeing your suggestion now (thought I was subscribed to the thread, but wasn't) -- so, sorry for the delay in answering!

Yes it works! The counties get listed alphabetically -- and even though the English/N.Irish/Scottish/Welsh counties are now all jumbled up -- at least people using the site know where to find their county in the list.

Thanks so much -- you're a star!

Here's a screenshot of what it looks like now, for anyone else looking to make this change

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.

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...