Support Center

How to link marker to Google Map Directions

Last Updated: Sep 16, 2014 05:42PM EEST
All our latest products come integrated with Google Maps. We have added a custom Google Map block that you are able to place in any Drupal theme region through Home » Administration » Structure » Blocks.



In addition, this Google Map comes with a specific Google Map marker that you are able to specify its Latitude and Longitude through your theme settings.



Regarding the Google Map marker, we have received some support requests on how this marker could be a link to the Google Map Directions, so the user be able to find directions to this specific address just by entering his starting point.

We would like to inform you that we will include the following implementation in our next product releases. In the meanwhile, in case you need this behavior for your Google Map marker, please edit your template.php file into your theme folder and make the following code changes/additions:

1. Add URL to your existing Google Map marker definition (template.php)
 
marker = new google.maps.Marker({
map:map,
draggable:true,
position: myLatlng,
url: "https://www.google.com/maps/dir//'.$google_map_latitude.','.$google_map_longitude.'/@'.$google_map_latitude.','.$google_map_longitude.'"
});

2. Add the following listener to your Google Map (template.php)
 
google.maps.event.addListener(marker, "click", function() {     
window.open(this.url, "_blank");
});

Please just place this new listener above the existing listener, so finally your code will be:
 
google.maps.event.addListener(marker, "click", function() {     
window.open(this.url, "_blank");
});
                
google.maps.event.addDomListener(window, "resize", function() {
map.setCenter(myLatlng);
});





In case this article leaves any of your questions or concerns unanswered, please feel welcome to email us or post a public question.

More than (just) Themes
http://www.morethanthemes.com/

Contact Us

support-agent@morethanthemes.com
http://assets3.desk.com/
false
morethanthemes
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete