[SOLVED] How to get markers list in CGGoogleMaps2

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

[SOLVED] How to get markers list in CGGoogleMaps2

Post by blast2007 »

Just upgrade from CGGoogleMaps (where I used sidebar) and I have no idea how to achieve this on CGGoogleMaps2.

I read on module help section "Users developing applications centered around a map can modify the map template of their map to quite easily add a sidebar." :) funny But how?

Any clues?
Best regards
Last edited by blast2007 on Fri Aug 29, 2014 6:20 am, edited 1 time in total.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: How to get markers list in CGGoogleMaps2

Post by blast2007 »

Now I got markers list with getMarkerList() but I don't know how to open infowindow for a single marker...
...anyone?
I can't understand if nobody use this module yet. Too new?

Thanks and regards
b.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: How to get markers list in CGGoogleMaps2

Post by blast2007 »

---- up ----
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: How to get markers list in CGGoogleMaps2

Post by calguy1000 »

use the showInfoWindow method.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: How to get markers list in CGGoogleMaps2

Post by blast2007 »

Thanks for your help but I'm really in trouble with all this CGclass* and its methods.
My map template is this:

Code: Select all

...
<div id="underbar"></div>
{* javascript is on the bottom incase some smarty variables we need were set in the various generator calls *}
<__script__ type="text/javascript">
if( typeof(jQuery) == 'undefined' ) {
  var div = document.getElementById('cggm_map_{$mapinstance}').
  div.innerHTML = '<h3 style="color: red;">jQuery and jQuery UI Are Required</h3>';
  throw new Error('jQuery and jQuery UI Are Required');
}
$(document).ready(function(){
  var obj = $('#cggm_map_{$mapinstance}');
  obj.cggm2({$generator->get_map_options_js()});

  var myobj = obj.cggm2('getMarkerList');

  for (var i = 0; i < myobj.length; ++i) {
  $("#underbar").append( myobj[i].value + " - " +    myobj[i].text + "<br />");
...
Now I understand how to show markers list but I can't understand how to use showInfoWindow method on this list!

regards
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: How to get markers list in CGGoogleMaps2

Post by calguy1000 »

It really isn't that hard.

a: build your sidebar, given the marker names
(each item should be a separate block, and inside that block you can have a link)
a structure something like <a class="showinfowindow" data-marker-name="some_place">Some Place</a>
b: add a jquery event handler function to trap a click on a sidebar item
- retrieve the marker name
- call obj.cggm2('showInfoWindow',the_marker_name');

Code: Select all

$('#sidebar a.showinfowindow').click(function(){
   var the_marker_name = $(this).data('marker-name');
   obj.cggm2('showInfoWindow',the_marker_name);         
});
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: How to get markers list in CGGoogleMaps2

Post by blast2007 »

YEEEESSSSSS IT WORKSSS!!!

Thanks so much calguy1000!!!

Best regards
blast
Post Reply

Return to “Modules/Add-Ons”