I would like to add a "Map it on Google" link to the .tpl file, but I can't figure out how to break apart the $info['customer_shipping'] component.

I tried something like this as a test but I am clearly missing something...:

http://maps.google.com/?q= print $build['commerce_order'][$order->order_id]['commerce_customer_shipping'][0]['#value'];

Any clues or pointers would be appreciated...

Comments

bearstar’s picture

Status: Active » Closed (fixed)

If anyone else wants to add this, here is the code I used.

<?php

$profile = commerce_customer_profile_load($order->commerce_customer_shipping['und'][0]['profile_id']); 
if ($profile) {
 $field_values = field_get_items('commerce_customer_profile', $profile, 'commerce_customer_address');
$thoroughfare =  $field_values[0]['thoroughfare'];
$zip =  $field_values[0]['postal_code'];
echo "<a href=\"http://maps.google.com/?q=".$thoroughfare." ".$zip."\">Map it on Google</a>";
}

?>
bearstar’s picture

Issue summary: View changes

fixing my code snippet