Extension, Fieldtype, Module, Plugin

Archived
Forum
(read-only)

Google Maps for ExpressionEngine

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Objective HTML

     

Issue getting anchor link to popup info Windows w/entry-based markers

Support Request

smartpill
smartpill

I’m following your demo here and am having an issue getting the links to work.

I think the issue is that since I’m using the Marker Clustering from Channel Data code, there doesn’t seem to be any “entry_id” attribute output into the markers. I don’t see another way to make it work.

In your demo I see

map_markers[index].entry_id 1397 

which doesn’t appear in mine. I pasted examples of each below.

is there a way to get that entry_id data into the markers using the “markers from channel entries” method so the script works?

Example marker script from your demo:

var index map_markers.length;map_markers[index] = new google.maps.Marker({mapmap_mapposition: new google.maps.LatLng(35.6119313,-83.5496566), icon""});
map_markers[index].entry_id 1397;
map_markers[index].index 0;map_bounds.extend(new google.maps.LatLng(35.6119313,-83.5496566));
         if (
index 0{map_map.fitBounds(map_bounds);
         
else {map_map.setCenter(map_bounds.getCenter());map_map.setZoom(map_options.zoom);
         

Example from my page:

var index map_markers.length;
var 
newMarker   = new google.maps.Marker({mapmap_mapicon{url"/maps/Images/house.png"}position: new google.maps.LatLng(41.7570066,-72.1862568)});
        var 
isDuplicate false;
        
        if(
typeof map_positions == "undefined"{
         map_positions 
[];
        
}
        
        
if(map_markers.length 0{
         
for(var 0map_markers.lengthi++) {
        
          
var marker map_markers[i];
          
          var 
newMarker.getPosition();
          var 
marker.getPosition();

          if(
a.lat() == b.lat() && a.lng() == b.lng()) {
           newMarker
.setMap(null);
          
}  
         }
;
        
}
        
        map_positions
.push(newMarker.getPosition());
        
map_markers[index] newMarker;map_markers[index].index 0;map_bounds.extend(new google.maps.LatLng(41.7570066,-72.1862568));map_map.fitBounds(map_bounds);
   (function () 
{
    
    
var options {
     alignBottom
false,
     
boxClass"ui-infobox-lhdct",
     
boxStyle{width'300px'},
                 
closeBoxMargin"6px",
                 
closeBoxURL"/assets/graphics/icons/close.png",
                 
content:  '<div class="ui-infobox-content"><div class="ui-infobox-content"><ul class="listless"><li><strong>Name:</strong> Oliver Bingham House</li><li><strong>Address:</strong> 88 Mansfield Hollow Road, Mansfield, CT</li><li><strong>Parcel ID:</strong> 34/110/22</li></ul></div></div>',
                 
disableAutoPanfalse,
                 
enableEventPropagationfalse,
                 
infoBoxClearance: new google.maps.Size(00),
                 
isHiddenfalse,
                 
maxWidth0,
                 
pane"floatPane",
                 
pixelOffset: new google.maps.Size(15, -45),
                 
zIndexnull
          }
;

    var 
infowindow  = new InfoBox(options);
     
    var 
obj map_markers[index];  
       
    
    
map_windows.push(infowindow);
        
    
google.maps.event.addListener(obj'click', function(e{
     obj
.position e.latLng;       
     
obj.getPosition = function() {
      
return e.latLng;
     
}     
      
for(var 0map_windows.lengthi++) {
       map_windows[i]
.close();
      
}
     infowindow
.setPosition(e.latLng);
     
infowindow.open(map_mapobj);
     
    
});
    
    
map_window infowindow;
    
   
})(); 

 

smartpill
# 1
smartpill

Bump.

Objective HTML
# 2
Developer
Objective HTML

Sorry for lack of reply. This one slipped past me and didn’t have a chance to reply yesterday.

So let me confirm, you are wanting to access the entry_id property on marker objects in conjunction with the marker clusters?

smartpill
# 3
smartpill
Objective HTML - 31 October 2013 03:34 PM

Sorry for lack of reply. This one slipped past me and didn’t have a chance to reply yesterday.

So let me confirm, you are wanting to access the entry_id property on marker objects in conjunction with the marker clusters?

I want to be able to click the anchor link and popup the associated infobox. In your example you reference the entry_id in the script. But anyway to make it work with the output using the “markers from channel entries” method is fine. I just don’t see the entry_id in the script output so I assume that’s why the jquery example isn’t working in my case.

Objective HTML
# 4
Developer
Objective HTML

I had a chance to check the code to look into a solution for this. Add the entry_id param to the exp:gmap:marker tag and just pass the id to it from the channel entries loop. That should add the entry_id to the marker object. Now, whether that fixes your js issues I am not sure, but this will allow you to test.

smartpill
# 5
smartpill

An example of what you mean would be extremely helpful. I did this:

{exp:gmap:marker id="map" latitude="{lhd_cf_latitude}" longitude="{lhd_cf_longitude}" infobox="true" geocode="false" clustering="false" icon="/maps/Images/house.png"
 
open_windows="false"
 
show_one_window="true"
 
window_trigger="mouseover"
 
}<div class="ui-infobox-content">
 <
ul class="listless">
<
li><strong>Name:</strong{lhd_cf_common_name}</li></ul>
<
span style="display: none;">{entry_id}</span>
 </
div>
 
{/exp:gmap:marker} 

And although it added the entry_id,  this didn’t help with the popup script issue.