Skip to content

Commit

Permalink
Improved and fixed address display in info windows on map.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanMan committed Aug 26, 2016
1 parent 8cf190e commit c50b041
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion models/AnyStoresModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public static function countPublishedByPid($intPid)

/**
* Get the details from a store
* @return \AnyStoresModel
* @return AnyStoresModel
*/
public function loadDetails()
{
Expand Down
2 changes: 1 addition & 1 deletion modules/ModuleAnyStoresList.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ModuleAnyStoresList extends \Module
{

/**
* Template
* Template name
* @var string
*/
protected $strTemplate = 'mod_anystores_list';
Expand Down
30 changes: 17 additions & 13 deletions templates/modules/mod_anystores_searchmap.html5
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function initialize()

var markers = [];

for (var i = 0; i < stores.length; i++)
for (var i = 0, jj=stores.length; i < jj; i++)
{
var store = stores[i];

Expand All @@ -21,23 +21,27 @@ function initialize()
title: store.name
});

if ( store.marker )
{
marker.setIcon(store.marker);
}
if(store.marker) marker.setIcon(store.marker);

var infowindow = new google.maps.InfoWindow();

google.maps.event.addListener(marker, 'click', (function(marker, i) {

var html = "<b><a href=\"" + store.href + "\">" + store.name + "</a></b><br>";

(store.street !="") ? html += store.street + "<br>" : "";
(store.city !="") ? html += store.postal + " " + store.city + "<br>" : "";
(store.phone !="") ? html += store.phone + "<br>" : "";
(store.url !="") ? html += "<a href=\"" + store.url + "\">" + store.url + "</a><br>" : "";
(store.email !="") ? html += "<a href=\"mailto:" + store.email + "\">" + store.email + "</a><br>" : "";
(store.href !="") ? html += "<br><a href=\"" + store.href + "\">Mehr Informationen</a>" : "";
var html = '<p class="mapaddress"><span class="name">';
if(store.href)
html += '<a href="' + store.href + '">' + store.name + "</a>";
else
html += store.name;
html += '</span>';

if(store.street !="") html += '<br><span class="street">' + store.street + "</span>";
if(store.city !="") html += '<br><span class="postal">' + store.postal + " " + store.city + "</span>";
if(store.phone !="") html += '<br><span class="phone">' + store.phone + "</span>";
if(store.url !="") html += '<br><a class="url" href="' + store.url + '">' + store.url + "</a>";
if(store.email !="") html += '<br><a class="email" href="mailto:' + store.email + '">' + store.email + "</a>";
if(store.href) html += '<br><a class="more" href="' + store.href +
'"><?=$GLOBALS['TL_LANG']['anystores']['more']?></a>';
html += '</p>';

return function() {
infowindow.setContent(html);
Expand Down

0 comments on commit c50b041

Please sign in to comment.