Closed (fixed)
Project:
Ubercart Addresses
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Apr 2013 at 18:46 UTC
Updated:
28 Apr 2013 at 18:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
megachrizIt looks like there is something wrong with the Ubercart Addresses address formats. An address format is used to create an address "label" and in your screenshots these labels look empty (thanks for posting the screenshots to clarify the problem!). Go to /admin/store/settings/countries/uc_addresses_formats and check if the address formats for Ubercart Addresses are set right. An address format should look something like this:
It can look different, depending on the country.
Did this issue happen on a fresh install of Drupal + Ubercart + Ubercart Addresses? Or did this happen on an upgrade from Ubercart Addresses 6.x-1.x or 6.x-2.x?
Comment #2
countach commentedI have everything OK in /uc_addresses_formats. I tried to save all settings once more. The status is changed to overridden but that didn't help.
I think there is more to the problem, cause when I save the settings in admin/store/settings/countries/formats I got an error:
"Warning: Illegal string offset 'address_format' in uc_country_formats_form_submit() (line 190 of D:\server\mysite\sites\all\modules\ubercart\uc_store\uc_store.countries.inc)." But it also says that the country settings are saved.
It is a fresh install of Drupal 7.21 and Ubercart 3.4.
Comment #3
megachrizIt sounds like something goes wrong when saving address formats on admin/store/settings/countries/formats. Although Ubercart reports it saved the country settings, it probably didn't. Can you post a screenshot of this page? (I'm not sure if I can locate the problem with it, but I could look if it looks right.)
Did you try to edit the address format of one of the countries on admin/store/settings/countries/uc_addresses_formats? You can click on the country name to edit the address format.
Comment #4
countach commentedYup, tried that - it's says overridden, but still no luck.
Here are screenshots from all 4 pages.
Comment #5
megachrizIt took me some time to figure out, but I think I got a clue what's the cause of the issue. Since you disabled the country field, the setting for the Ubercart default country is not saved (I didn't knew about this behavior in Ubercart). Also, if the country field is disabled, Ubercart Addresses tries to pick the Ubercart default country to format the address with. Since there is no default country, Ubercart Addresses can't find the address format to use and choose to display nothing. Yes, that is a bug.
In the first place, Ubercart Addresses shouldn't give up if it can't find an address format: it should at least use a default address format.
Second, I think it should look at the available countries when there is no Ubercart default country. Now it just picks U.S., even when that country is not available. I should examine what Ubercart does in this case.
A quick fix for you would be the following:
Meanwhile, I'll look for the real fix, though you won't need to wait for it as the steps above would solve the problem for you too.
Comment #6
countach commentedYeah, it worked. Thanks a lot :)
Comment #7
megachrizThis patch fixes two things:
The patch also includes a test to ensure the bug is fixed.
Comment #9
megachrizThe test is failing because of a caching issue in the tests.
uc_store_default_country()caches the default country in code using thestatickeyword instead of the more encourageddrupal_static()function. Because of this, this function can not be evolved in API tests like this. The test should be done via an other approach.The test in the attached patch disabled the country field and tests the output of formatted addresses using curl instead of the API. Additionally, some changes were needed in the base test class "UcAddressesTestCase", because the function for generating address edit values did not check for enabled fields.
Hopefully, this patch will pass all tests.
Comment #11
megachrizThe test that fails on drupal.org is passing locally. It looks I need to look for a nail in haystack.
Okay, next try. This patch uses
randomName()instead ofrandomString()to set the Canada address format (in the test).Comment #12
megachrizCommitted #11.
Moving to 6.x-2.x.
Comment #13
megachrizPatch for the 6.x-2.x version.
Comment #14
megachrizCommitted #13.
Setting issue status back to the version it was originally reported for and mark it as fixed.