I upgraded to Alpha 6 yesterday but just noticed that the location field I have set for my content type is not appearing when I go to Manage Fields. I noticed this while looking into another problem.. it appears that the Views address field puts the postal code infront of the city. For example, it is displaying an address as:

123 Main St
10453 New York City, NY

The biggest issue here is that when I try to add a new location it does not get added to my Gmap. I'm wondering if the backwards postal code is causing that problem?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dmcgrew’s picture

Alright, ignore the thing about the locations not being added to the Gmap. Apparently that was just some fluke (i hope). Everything else (the postal code, and content type field) are still broke though.

podarok’s picture

Status: Active » Needs work

#1 please. update summary for latest status

Neograph734’s picture

The module generates a php error here:
PHP Fatal error: Class 'DrupalWebTestCase' not found in /home/.../sites/all/modules/location/tests/location_testcase.php on line 8

podarok’s picture

hvasconcelos’s picture

Title: Upgraded to Alpha6, now my location field not showing in Content Type » Patch - ZIP Code showing in the wrong place
FileSize
883 bytes

I have tried both Alpha6 and Alpha8 version and experienced the same issue with the ZIP code showing up before the city and state.

Here's the patch for it, it worked for me. Make sure to clear the cache.

Jerenus’s picture

Status: Needs work » Needs review
podarok’s picture

Version: 7.x-3.0-alpha6 » 7.x-3.x-dev
Priority: Critical » Normal
Status: Needs review » Postponed (maintainer needs more info)
  1. Patch looks good for me, but is it international standard for showing ZIP code in this way or just for USA?
  2. This is normal, not critical issue
venutip’s picture

Just want to point out to others reading this issue that you don't need a patch to move the ZIP, as this is all happening at the theme level. All you have to do is:

1. Copy `location.tpl.php` from the Location module's root directory into your theme.
2. Edit the file and move the ZIP.
3. Clear cache.

While I'm here though, I can say that the patch does move the ZIP :)

hvasconcelos’s picture

Hey @venutip, that would work as well, thanks for sharing! I don't believe we should be having to do any of this in the first place, so the module must be problematic. Hopefully they will fix it on the next update.

@podarok, I am not aware whether that's an international standard, but I do know that at least in Brazil we show the ZIP code in the end of the address, too. So, I'm assuming it's not a standard.

dpovshed’s picture

Issue summary: View changes

Recently I had the same task formatting US address. Solution in #8 works for me!

About committing patch to the core - I did a small research and it looks that most popular place for ZIP is right before country name. However many european country like Italy or Belgium have postcode before site name.

Attention to @podarok:
This means if we silently move a zipcode we may introduce bugs for all existing users in several countries, which is not an option. So I vote for:
- keep current placement;
- close this issue as 'Work as designed';
- we have nice recipe as well as patch for cases where we need ZIP in different place.

For those who interested - here is one of resources to take a look at national samples - http://www.addressdoctor.com/en/countries-data/address-formats.html

tgriswold’s picture

I had the same issue and also used #8 to solve it.

A bit more detail for those who may be timid about trying this.

  1. As stated in #8, copy `location.tpl.php` from the Location module's root directory into your theme.
  2. To edit, simply remove lines 15-17 and place them after what is currently line 25, ( print $province_print; ) assuming you want the zip/postal code after the province (state) field.
  3. Then drop the edited version into the root level directory of your default theme, Zen in my case.
  4. Clear cashe and you are good to go.

If you have a need to turn it off for whatever reason, just change the name of the file you modified to something like `location.tpl.php.OLD` and the system will ignore the one you put in the theme and use the default one that is in the Location directory.

As for making this a core change, I would lean to adding some kind of easy configuration option that would allow the admin to select where the Postal Code displays. A bit of a pain, but I don’t think it should be necessary to modify code and drop things into modules to accommodate something as common as displaying Postal Code location. Of course I am not the one doing the work, so you can factor that in to the value of my opinion.

Thanks to venutip for a clean solution and to all for their assistance and feedback.

System Lord’s picture

#8 via #11 worked great from me. Although, my first line for the code began at 16. Just fyi for others. I would also agree with #11...

I would lean to adding some kind of easy configuration option that would allow the admin to select where the Postal Code displays.

Thank you

medialantern’s picture

I disagree with #1943912-10: Patch - ZIP Code showing in the wrong place. I believe the change that switched this postal code location should be reverted. Then, either the technique outlined above in #1943912-8: Patch - ZIP Code showing in the wrong place should be recommended for OTHER countries, or a proper fix implemented.

Somebody is going to break, because there is no universal solution. But I think a more rational choice for WHO should break should be based on something like population counts (# of mailing addresses likely to be affected), not gut instincts. Of the 10 most populous countries in the world (China, India, USA, Indonesia, Brazil, Pakistan, Nigeria, Bangladesh, Russia, and Japan), only China and Nigera have addresses where the postal code comes first. Moreover, this change a) doesn't even get Nigeria's correct, anyway, and b) neither before/after properly format China's (in fact, some PRC addresses are more complex than the Location module can even handle internally).

Deliberately breaking the vast majority of the world population's address formats until a more configurable "fix" can be implemented is the wrong approach, IMHO. Having that same group be the ones who need to implement the fix is also wrong.

Disclaimer: I reside in one of the 10 most populous countries. I do not believe that makes the opinion wrong.

RWill’s picture

#8 worked for me.

ak55’s picture

#8 worked for me too. Thanks!

Michael-IDA’s picture

Status: Postponed (maintainer needs more info) » Needs review

Per the logic in #13 this should have been fixed two years ago, not just left in limbo.

Switching back to needs review.

SeanA’s picture

FileSize
957 bytes

Patch against latest dev.

Putting the postal code after the province probably covers the vast majority of users, but many countries in Europe do put the postal code before the city/locality. More information about international address formats: http://www.bitboost.com/ref/international-address-formats.html

Michael-IDA’s picture

+1, Works on an ugly multi-site.

But . . .

Your code is too well formatted. I get:

"Boston , MA 02108"

The extra space is coming from the print $city; /span> having white space between it and the print ', ';

I'd say I'll submit a patch, but . . . Holidays will probably nix that.

Best,
Michael

SeanA’s picture

Status: Needs review » Needs work

The extra whitespace is/was already present in the tpl file. Needs work. =/

Michael-IDA’s picture

Status: Needs work » Needs review
FileSize
1.23 KB

Patched against version = "7.x-3.7" (same as dev for location.tpl.php)

Incorporating patch from #17, added cleanup of whitespace.

podarok’s picture

Status: Needs review » Fixed

Thanks, merged.

  • podarok committed 95eb448 on 7.x-3.x authored by Michael-Inet
    Issue #1943912 by Michael-Inet, hvasconcelos, SeanA: Patch - ZIP Code...

Status: Fixed » Closed (fixed)

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

hockey2112’s picture

Was this actually committed to 7.x-3.7? I am experiencing this issue on my website as well.

"90210 Beverly Hills, CA" instead of "Beverly Hills, CA 90210"

-------

Sorry, I misunderstood the prior post. I do see that this has not been committed to 7.x-3.7. I applied the patch and it worked great. Thanks!