In finland we tend to use only one address field instead two. That's why I request for new heuristic tweak for countries who tend to have thoroughfare and premise in one field.

Is there good references to check which countries tend to do same?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

iMiksu’s picture

FileSize
760 bytes

First patch against 7.x-1.0-beta2. We need more countries.. ?

iMiksu’s picture

Status: Needs review » Needs work
mefisto75’s picture

it's good to have an option to hide one of the address fields regardless of country.
I'm using (just configuring) addressfield, geocode and geofield modules and the second address field makes no sense apart from confusing users.

mefisto75’s picture

What if i just delete the following?

$format['street_block']['premise'] = array(
'#title' => t('Address 2'),
'#tag' => 'div',
'#attributes' => array('class' => array('premise')),
'#size' => 30,

Humphreybas’s picture

Another country would be The Netherlands, but I also think having an option to just manual disable the second line would be neat! This is not yet possible right?

iMiksu’s picture

@Humphreybas After couple days after posting this issue, I read #1316788: Do not display country in address block if only one country option is available and liked the approach of Damien Tournoud in comment #1.

I actually think that is the right approach because we already have two options on how to display name fields (First name + Last name OR just Name).

Should we just offer two line address and single line address fields just like name?

zarudnyi’s picture

Yes, it's a good idea because of Russian Federation are used only one line too.

iMiksu’s picture

I could write a patch for second approach, but would be great to have damiens or rszramas comments on this.

Now the address is labeled as "Address form (country-specific)" so if we want to stay in this approach, the first patch might be the approach. Second option is to split address component into different ways but as I remember, this approach was already taken before and is deprecated?

webankit’s picture

Second approach patch can be seen here http://drupal.org/node/1010314#comment-5271544

miahon’s picture

Yes, we have the same problem here in Ostrobothnia :) Any damiens or rszramas comments?

klonos’s picture

sokrplare’s picture

Status: Needs work » Closed (duplicate)

Agreeing with klonos and closing as dupe of #1010314: Separate Components of Address field

mar4ehk0’s picture

Issue summary: View changes
FileSize
4.83 KB

Hello,
Created patch for settings show field "address 2"
Admin can select country for show this field

siggi_hrafn’s picture

@mar4ehk()

I seem to have a problem with the addressfield-133756-13.patch using Address 7.x-1.0-beta5

Here is Terminal output:
===================

Siggi-Mac:addressfield sigurdurhrafnthorkelsson$ patch < addressfield-133756-13.patch
patching file addressfield.module
can't find file to patch at input line 67
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/sites/all/modules/addressfield/plugins/format/address.inc b/sites/all/modules/addressfield/plugins/format/address.inc
|index d5426ad..cc8074d 100644
|--- a/sites/all/modules/addressfield/plugins/format/address.inc
|+++ b/sites/all/modules/addressfield/plugins/format/address.inc
--------------------------
File to patch:
===================

Any ideas on what is going wrong?

UPDATE!

Fixed this by moving address.inc to addressfield root folder while patcing - and then moved the address.inc back to folder /plugins/format/address.inc (overwrite)
It's working fine now.

czigor’s picture

Status: Closed (duplicate) » Needs review
FileSize
4.64 KB

Reopening this as the issues above are duplicates of #1829900: [meta] Address Field 2.x needs pluggable administrative areas and an actual API which in turn says:

This ticket is simply about providing a better method for importing Country -> State data. All other edge cases, will need to be completed in another ticket.

Rerolled the patch in #13 as it was made relative to the drupal root. Also made a small modification which fixes some notices appearing on the field settings form.

Otherwise the patch works great, thanks!

janadam’s picture

Patch #15 is working form me with version 7.x-1.0-beta5. Thank you.

nielvrom’s picture

Thanks for Patch #15, works perfectly!

bojanz’s picture

Status: Needs review » Closed (won't fix)

I won't be committing this, because the presence of the address2 field is country specific, not field instance specific.

I just encountered the same issue with Australia:
https://www.drupal.org/node/1713698#comment-9422021

The fix I implemented was to rename "Address 1" to "Address", and remove the "Address 2" label, but keep the field.
This provides a safe fix, leaves the line for cases that need it, but decreases customer confusion.
You can add your country code to this part of address.inc:

  if (in_array($address['country'], array('AU', 'NZ'))) {
    // These countries don't use the "Address 2" line.
    // Leave it as a precaution, but hide the label to avoid confusing users.
    $format['street_block']['thoroughfare']['#title'] = t('Address');
    $format['street_block']['premise']['#title_display'] = 'invisible';
  }

and then send in a patch.

Andrej Galuf’s picture

I found this to still be too confusing (and not user-friendly), so I reversed your solution and modified your line to this instead:

  if (!in_array($address['country'], array('US'))) {
    $format['street_block']['thoroughfare']['#title'] = t('Address');
    $format['street_block']['premise']['#access'] = FALSE;
  }

Still, I think this shouldn't be hardcoded - a better option is to allow this as a setting in address field configuration or at least as an option in the form of an alter hook.

bojanz’s picture

It can't be a field setting because it's different for each country. This means that it can only live in the address format.
However, I know no official source that would give us definitive information on which countries use and which don't use the second address line.

Andrej Galuf’s picture

True. Ok, two more ideas:

1. Better: Button that would reveal address 2 when the user would choose it

2. Easier: Label address 2 field as optional. People get confused here if we don't explicitly label it as such.

donquixote’s picture

I was wondering how this is in Germany.

Most of the time, I only see "Straße / Hausnummer" (street and number).
Sometimes these are two separate fields. But usually they are on the same line.

http://www.postadressglobal.com/de-de/country/deutschland/formatierung-u...
This article says that postal address in Germany always has one row for street + number..
Btw, there are also pages about some other European countries.

https://www.informatica.com/products/data-quality/data-as-a-service/addr...
Here is another reference, this time in English.
It seems that the "Address 2" is usually used for apartment number / floor number / room number.

In Germany, I find these cases:
- Usual apartment buildings, where the post boxes and door bells are labeled with the name of the family or company. So, no need for a room number.
- Company buildings, hospitals, schools, etc. To address a specific person or department, one would write one line with the company name, one line with the person or department name, one line with the street + number, one line with the zip + city.
- Hospitals: To address a specific person currently in hospital, one would write one line with the person name, one line "currently in hospital xyz", then one line for the street + number of the hospital, then one line for zip + city.

I think I have seen some cases with an "address 2" field, but this was usually because of a character limit on the first row, or maybe because it was copied from a US system. In general, it would seem, an "address 2" is not needed in Germany.

On the other hand, sometimes there are two lines needed for name + company + department.

When I see an "address 2" field, I will usually ignore it, or assume it is for very long street names.
I prefer an address field that is labeled "street / number". Or even two separate fields for street + number. All on one line.

EDIT: To summarize and clarify: The main difference is that door bells and mail boxes in Germany have actual names on them, not room numbers.

-----------

Another thing I wonder about is what the geocoder (for geofield) will do with the extra information with room number, company name, department name, etc.

donquixote’s picture

Maybe the requirements and subtleties for geocoding / location are not 100% identical with the requirements for postal addresses..

candelas’s picture

@donquixote, at the end I understood why address 1 and 2 :) In Spain, we put the street in the first and the the street number, floor and door in the second in many forms. But the address field is confusing because I (and others asking so many times) were understanding to write two different addresses or something without sense. So changing the names will make, at least in Spain, more user-friendly.