Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Addresses may be formatted differently in different countries. This makes it important to be able to control the format of an address based upon the country of that address.

      For example, a user with a business in the USA may have customers in India, and may need to send letters of correspondence. In such a case the address should automatically be formatted in accordance with standards defined by India.

      To make this possible we need a database to store addressing formats for each country. This simplify, this should use the tag/replacement approach.

      For example, suppose we want to define the address format for the US. We would have the following entry in our new address_formats table:

      country format
      US
       {first_name} {last_name}\n{company}\n{address1}\n{address2}\n{city}, {state.code} {zip}\n{country.name} 

      The parser (H2o) would then do tag replacements. However, note that if a particular field is empty that line may not be drawn.

      The parser should return all results as an array of lines. Using our US example above:

      array(
        [0] => "Cody Phillips",
        [1] => "Phillips Data, Inc.",
        [2] => "1234 E Test St.",
        [3] => "Testville, CA 90000", // Note: no address2, so line is skipped
        [4] => "United States of America"
      );
      

      This allows any portion of the system to render the address as needed, whether it be HTML, PDF, or XML for that matter.

      Finally, there should be a section under system settings to configure address formats for each country. By default we will attempt to enter the correct configuration for the most popular 20 - 30 countries. All others will default to the US standard. So it's important to make this user configurable.

      Address format resources:
      http://www.upu.int/en/resources/postcodes/universal-postcoder-database.html
      http://bitboost.com/ref/international-address-formats.html#Formats

        Activity

        Hide
        cody Cody Phillips (Inactive) added a comment - - edited

        For US military overseas mailing, would need the following non-ISO states (which can be done with Tyson's Country and States plugin):

        • AA
        • AP
        • AE

        City must be APO or FPO or DPO.

        For example:

        • Name: John Smith
        • Address Line 1: PSC 3 BOX 4120
        • Address Line 2:
        • City: APO
        • State: AE
        • Zip: 09021-1234
        • Country: USA

        Produces:

        John Smith
        PSC 3 BOX 4120
        APO AE 09021-1234
        USA

        Show
        cody Cody Phillips (Inactive) added a comment - - edited For US military overseas mailing, would need the following non-ISO states (which can be done with Tyson's Country and States plugin): AA AP AE City must be APO or FPO or DPO. For example: Name: John Smith Address Line 1: PSC 3 BOX 4120 Address Line 2: City: APO State: AE Zip: 09021-1234 Country: USA Produces: John Smith PSC 3 BOX 4120 APO AE 09021-1234 USA

          People

          • Assignee:
            cody Cody Phillips (Inactive)
            Reporter:
            cody Cody Phillips (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: