• The place I am building a site for is in Shibuya, Tokyo, Japan. The current setup for venue maps implodes an array list or values into US addressing standards, which does not work for Japanese addressses.

    This is what is shown.

    宇田川町19-5 山手マン, 都渋谷区, 東京, 150-0042
    (street), city, state, zipcode

    It should look like
    東京都渋谷区宇田川町19-5 山手マンション601 〒150-0042

    (state)(city)(address) (postalcode)(country)

    In the US version there are commas in the Japanese version there is only 1 space separating the core address from the postal code.

    I think what you should do instead of imploding the array is allow users a format variable kind of like what date() does, but for addresses. Give them 2 ways to format it. One for displaying on the web, the other for giving to google maps.

    Also on the US format don’t use the commas as they are un-needed by google google will process a US address properly without them.

    http://wordpress.org/extend/plugins/event-organiser/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter James Andrews

    (@thenetimp)

    Here’s the solution all coded out if you want to use it.

    Change line 633 of event-organiser-venue-functions.php to this.
    $tooltip_content = eo_address_formatter('a, c, s, p, C', $address);

    Then add this function to the same file somewhere.

    function eo_address_formatter($format, $address_array)
    {
        // Format characteers and their associated values
        $format_map = array(
            's' => 'state',
            'c' => 'city',
            'a' => 'address',
            'p' => 'postcode',
            'C' => 'country',
        );
    
        $address = "";
    
        for($i = 0; $i < strlen($format); $i++)
        {
            if(isset($format_map[$format[$i]]))
            {
                $address .= $address_array[$format_map[$format[$i]]];
            }
            else
            {
                $address .=$format[$i];
            }
        }
    
        return $address;
    }

    Then all we’d need is somewhere to be able to choose the format. Probably on the venue page so that way you can choose the format based on the venue, as some places may have events in more than one country.

    Plugin Author Stephen Harris

    (@stephenharris)

    So Google can’t find the Japanese address – this will need fixing. (By the way, for bugs like this, or code you want see in the plug-in – feel free to make a pull request https://github.com/stephenharris/Event-Organiser – much better forum for this kind of thing, and you get contributor kudos too 🙂 )/

    As for the tooltip, you can already change the content of the tooltip using a filter – and so avoid making any changes to the core plug-in:

    http://wp-event-organiser.com/documentation/hook/eventorganiser_venue_tooltip/

    More generally there is nothing that ‘displays’ the venue address: eo_get_venue_address() returns the constituent parts as an address, so in a theme template you can free format it as desired. So I’ll put the address template idea on hold for now.

    I’m also struggling to display Japanese address by using eo_get_venue_address(). Could you give me example codes?

    For the moment my code looks like this to display an address starting, postcode, state, city, and address.

    <?php $address_details = eo_get_venue_address(); echo $address_details['postcode']; ?><?php $address_details = eo_get_venue_address(); echo $address_details['state']; ?><?php $address_details = eo_get_venue_address(); echo $address_details['city']; ?><?php $address_details = eo_get_venue_address(); echo $address_details['address']; ?>

    But it could be great if I can arrange the format within a one line of code, such as the following which made my page blank.

    <?php $address_details = eo_get_venue_address(); echo $address_details['postcode','state','city','address'']; ?>

    I have no idea about PHP, so more exapmples on your document would help us a lot!!

    Plugin Author Stephen Harris

    (@stephenharris)

    There’s no need to make repeated calls to eo_get_venue_address(), the following should work,

    $address_details = eo_get_venue_address();
    echo $address_details['postcode'];
    echo $address_details['state'];
    echo $address_details['city'];
    echo $address_details['address'];

    But for readability I would recommend the following:

    $address_details = eo_get_venue_address();
       printf(
         'The venue is in %1$s, %2$s, and has postcode %3$s',
         $address_details['city']
         $address_details['state']
         $address_details['postcode']
       );

    which displays something like ‘This venue is in [city],[state], and has postcode [postcode]’.

    takuya

    (@takuya)

    Thank you Stephen!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Foreign Addresses show incorrect maps’ is closed to new replies.