Map not showing on event page
-
Hi Stephen.
I have been having trouble getting Google maps to display on event detail pages. I’m using EO 1.8.2.
The error in the JS console was from https://maps.gstatic.com/intl/en_ALL/mapfiles/api-3/12/5/main.js:
TypeError: 'null' is not an object (evaluating 'a[ib]')
After reading other support requests, and trying to eliminate as many as possible e.g. theme conflicts, I started digging a bit further and think I have found the problem.
At event-organiser/js/frontend.js:376 the code attempts to load Google maps for all eo_venue_map-N divs on that page, starting from index 0 to maps.length. Looking at the HTML from my event detail page, the only div is eo_venue_map-4, so the getElementById tries to pass null to google.maps.Map(), which bombs.
To avoid this, I’ve added two lines before:
if (null === document.getElementById("eo_venue_map-" + (i + 1))) continue;
So that non existent map divs 0, 1, 2 and 3 are skipped, and 4 is populated. This allows the single map to display correctly.
Does that all make sense to you? Is this the way that function is supposed to work? And what do you reckon is the best course of action from here, presuming something else isn’t going on?
Any questions just let me know ??
Thanks
James
- The topic ‘Map not showing on event page’ is closed to new replies.