The countries in the select box should be sorted after translation, not before. Now the translated country names will keep the English sort order, which of course is not in alphabetical order then. It is really difficult to find your country in the long list when it is not in alphabetical order. A average person will not try to find "España" among countries beginning with an S.

Comments

tr’s picture

Status: Active » Postponed (maintainer needs more info)

The countries currently *are* sorted after translation, on line 316 of uc_store.module, so it's not clear why it doesn't work for you. Can you examine the $countries array both before and after the natcasesort to see what's happening?

longwave’s picture

Category: bug » support

I can't reproduce this on the checkout page, with three languages installed and the translations uploaded from localize.drupal.org, the country dropdown is sorted correctly. What page are you talking about? Screenshots might help here, or a link to a site that demonstrates the problem.

ñull’s picture

StatusFileSize
new42.19 KB

longwave, I see this on the page /cart/checkout. I used a bit more countries then you and may be that is the reason you don't see it? Here the screenshot when the interface language is set to Spanish:


screenshot country select

As you can see "Eslovaquia", "Eslovenia" and "España" should not be between "Serbia" and "Svalbard y Jan Mayen".

TR I was never really successful to get a debugger going with PHP, so what do you suggest to get a listing of the array you are talking about?

longwave’s picture

I have all the countries enabled, but I was testing in French and German. I will try adding Spanish when I get some time.

longwave’s picture

Status: Postponed (maintainer needs more info) » Active
megachriz’s picture

This is likely be a bug in the Ubercart Addresses module only and not in Ubercart, as I can not reproduce the bug with a minimal Ubercart installation, but I'm able to reproduce it with Ubercart Addresses installed.

Ubercart Addresses overrides the address checkout panes of Ubercart and also redefines all address fields in it. This is done this way to add support for extra address fields and to let each field act in the same way. I see in the Ubercart Addresses' country field handler that I forgot to add a call to natcasesort() to order the countries after translation. I never tested checkout with almost all countries enabled, so I didn't notice it until now.

Debugger
If you have the Devel-module installed, you can use krumo():

if (has_krumo()) {
  krumo($variabele);
}

Without Devel-module installed:

print '<pre>';
print_r($variable);
print '</pre>';

This issue may be moved over to the Ubercart Addresses issue queue after confirmation of the original reporter this is an Ubercart Addresses issue only. Meanwhile, I will work on a patch for Ubercart Addresses.

longwave’s picture

Confirmed that if I install uc_addresses on my test site, the addresses are incorrectly sorted in languages other than English, and disabling uc_addresses makes them correctly sorted again.

ñull’s picture

Project: Ubercart » Ubercart Addresses
Version: 7.x-3.x-dev » 7.x-1.x-dev
Category: support » bug

Well yes, I have that module installed as well, so I moved this issue to the right Project .

Thanks for your tips on debugging

megachriz’s picture

Assigned: Unassigned » megachriz
Status: Active » Needs review
StatusFileSize
new2.39 KB

This patch adds the natcasesort() call to Ubercart Addresses' country field handler as well as some little code cleanup.

megachriz’s picture

Attached patch adds also the natural order on the "Ubercart Addresses address formats" page (admin/store/settings/countries/uc_addresses_formats).

megachriz’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Committed #10.

Moving to 6.x-2.x as it needs to be fixed there as well.

megachriz’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new5.63 KB

Patch for the 6.x-2.x version.

megachriz’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Fixed

Great, tests for the 6.x-2.x version also pass. Committed #12.

Setting issue back to the original version it was reported for and mark it as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.