Okay
  Public Ticket #274367
Google maps - markers not visible anymore
Closed

Comments

  • Atishi started the conversation

    Hi,

    I have had a smooth sailing while using this theme. If there were any hitches, I could find an answer in the existing tickets. But now I'm stumped.

    A while ago I was having no trouble with the map. Only today I noticed that the markers aren't visible anymore.

    I have already updated the theme and cleared the cache. Still can't see the markers. I had added the values to the VC on the Contact Us page. Just to leave no stone unturned, I added the values to the 'Contact' section in the Salient theme options as well. Still no markers.

    Please help.

    Thanks in advance.

  • Andrew replied

    Seeing the same thing.  Updated to the latest version of Salient but nothing.  The Debugger shows the error in map.js (line 264):

    Unable to get property 'id' of undefined or null reference

    $(markerImgLoad).load(function(){

    setMarkers(map[i], map[i].__gm.ka.id, $count);

    });

    }

    else {

    setMarkers(map[i], map[i].__gm.ka.id, $count);

    }

    });

    Any help appreciated.

  • [deleted] replied

    The script is trying to pull the map's div id with this notation: map[i].__gm.ka.id ... which I have never really seen before so I am not familiar with it.

    I resolved this issue by creating a new global var to house the map ids:

    //line 14 - 15

    var map = [];
    var map_ids = [];  //new var
    

    Then capture the id:

    //line 250ish

    map_ids[i] = $(this).attr('id'); //capture id here
    map[i] = new google.maps.Map(document.getElementById($(this).attr('id')), mapOptions);
    

    Then change this block:

    //line 258ish

    		google.maps.event.addListenerOnce(map[i], 'tilesloaded', function() {
    				//don't start the animation until the marker image is loaded if there is one
    				if(markerImg.length > 0) {
    					var markerImgLoad = new Image();
    					markerImgLoad.src = markerImg;
    					$(markerImgLoad).load(function(){
    						 //setMarkers(map[i], map[i].__gm.ka.id, $count);
    						 setMarkers(map[i], map_ids[i], $count);
    					});
    				}
    				else {
    					 //setMarkers(map[i], map[i].__gm.ka.id, $count);
    					 setMarkers(map[i], map_ids[i], $count);
    				}
    		    });
    

    Problem fixed (I think) ... didn't do too much testing.

  • Andrew replied

    I haven't made those changes (thanks btw) but it all seems to be fixed this morning!  Not sure what has changed.

  • Atishi replied

    Same as Andrew. Without having to make any changes, the markers showed up this morning. 

    Thank you for helping out anyway.