Closed (fixed)
Project:
Ubercart Addresses
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
1 Nov 2012 at 18:31 UTC
Updated:
24 Nov 2012 at 10:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
tr commentedThe 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?
Comment #2
longwaveI 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.
Comment #3
ñull commentedlongwave, 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:
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?
Comment #4
longwaveI have all the countries enabled, but I was testing in French and German. I will try adding Spanish when I get some time.
Comment #5
longwaveComment #6
megachrizThis 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():
Without Devel-module installed:
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.
Comment #7
longwaveConfirmed 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.
Comment #8
ñull commentedWell yes, I have that module installed as well, so I moved this issue to the right Project .
Thanks for your tips on debugging
Comment #9
megachrizThis patch adds the natcasesort() call to Ubercart Addresses' country field handler as well as some little code cleanup.
Comment #10
megachrizAttached patch adds also the natural order on the "Ubercart Addresses address formats" page (admin/store/settings/countries/uc_addresses_formats).
Comment #11
megachrizCommitted #10.
Moving to 6.x-2.x as it needs to be fixed there as well.
Comment #12
megachrizPatch for the 6.x-2.x version.
Comment #13
megachrizGreat, 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.