Results 1 to 3 of 3

Thread: International Address Formatting

  1. #1
    psuter is offline Member
    Join Date
    May 2008
    Posts
    5

    Default International Address Formatting

    Hi There

    Is there a way i can change the way an address-block is being formatted.

    i want to use sugar crm for a swiss company with international customers and contacts. to give you an example of the different address block styles, this is how an address in switzerland is written:

    <salutation><first name><last name>
    <street><number>
    <zip code> <city>

    so as you can see we have first the road name and then the house number, which is no problem with sugar because they are not being separated. but the bigger problem are zip codes. we print them first and then the city name and we don't need to write down a state here in switzerland.

    on the other hand we have also us customers so we also need the us layout to work.

    in os-commerce for example, the way format of an address block is chosen by the addresses country. so if in the country field it says switzerland, os_commerce uses a different formatting than when it says usa. of course this means you need to have a dropdown with all countries otherwhise it might be difficult to always spell it right or to know weather to write US, USA ur United States in that field

    to implement an automatic formatting like in os commerce is a little too much work right now, but maybe i could add a dropdown field with some choices of how we need them to be formatted so i can choose the formatting for each of my addresses. the question is, what do i need to modify to make the address block appear in a different layout when i look at the detailed view for example?

    i'd appreciate your help

    regards
    pascal

  2. #2
    psuter is offline Member
    Join Date
    May 2008
    Posts
    5

    Default Re: International Address Formatting

    no one?

    well, i came a little further.. i found out that there is a definition how the address block will be displayed in /shugar_root/cache/moduls/Accounts/DetailView.tpl

    in there it states:

    {$fields.billing_address_street.value|nl2br}<br>

    {$fields.billing_address_city.value} {$fields.billing_address_state.value}&nbsp;&nbsp;{ $fields.billing_address_postalcode.value}<br>

    {$fields.billing_address_country.value}

    and the same again for shipping_address
    if i change these lines to:

    {$fields.billing_address_street.value|nl2br}<br>

    {$fields.billing_address_postalcode.value}&nbsp;&n bsp;{$fields.billing_address_city.value}<br>

    {$fields.billing_address_country.value}

    i do indeed get the right formatting for my swiss addresses (of course, our us customers do then hav a wrongly formatted address, but just as a proof of concept this shows that i can influence the way the block is displayed in here)

    but of course, as it is in the "cache" directory this is only a temprary cached file, and whenever i change something in the detail view with studio the file is being overwritten.

    does anyone have a clue where the permanent source for these lines lies? where does studio get that from?

    cheers
    pascal

  3. #3
    psuter is offline Member
    Join Date
    May 2008
    Posts
    5

    Default Re: International Address Formatting

    there is no reply like a self-reply

    allthough i can hardly believe that i am the only one with such a problem... and it seems it has even been foreseen in sugar crm for such a problem to exist.

    the source for that cached file if ound lies in

    /sugar_root/include/SugarFields/Address/DetailView.tpl respectively if you have specified a specific language like en_us it is in the same directory but in the file en_us.DetailView.tpl

    i exchanged the original lines with these:
    {if $fields.{{$displayParams.key}}_address_country.val ue == "USA" || $fields.{{$displayParams.key}}_address_country.val ue == "United States" || $fields.{{$displayParams.key}}_address_country.val ue == "America"}
    {$fields.{{$displayParams.key}}_address_street.val ue|nl2br}<br>
    {$fields.{{$displayParams.key}}_address_city.value } {$fields.{{$displayParams.key}}_address_state.valu e}&nbsp;&nbsp;{$fields.{{$displayParams.key}}_addr ess_postalcode.value}<br>
    {$fields.{{$displayParams.key}}_address_country.va lue}
    {else}
    {$fields.{{$displayParams.key}}_address_street.val ue|nl2br}<br>
    {$fields.{{$displayParams.key}}_address_postalcode .value}&nbsp;&nbsp;{$fields.{{$displayParams.key}} _address_city.value}<br>
    {$fields.{{$displayParams.key}}_address_country.va lue}
    {/if}

    so now it shows us addresses in the us layout and any other address (which in our case is mainly swiss and german addresses) in the swiss layout. i found no such file in the swiss german or in the plain german language packs so i guess all those customers just live with the fact that their addresses are formatted the wrong way...

    anyway, for me, this solved the problem for now.

    cheers
    pascal

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Better Address management between Leads and Contacts
    By bob149 in forum Feature Requests
    Replies: 0
    Last Post: 2008-06-19, 11:11 AM
  2. Replies: 0
    Last Post: 2008-01-22, 06:56 PM
  3. exporting enum custom fields
    By dricrm in forum Developer Help
    Replies: 0
    Last Post: 2007-07-18, 04:41 PM
  4. Bug: international phone number formatting
    By rickster in forum Help
    Replies: 1
    Last Post: 2006-08-01, 07:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •