WordPress.org

Ready to get started?Download WordPress

Forums

Event Organiser
[resolved] Map not showing on event page (5 posts)

  1. james.beard
    Member
    Posted 1 year ago #

    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 http://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

    http://wordpress.org/extend/plugins/event-organiser/

  2. Stephen Harris
    Member
    Plugin Author

    Posted 1 year ago #

    Hi James,

    A similar issue has occurred before, but I'm yet to identify what is causing the HTML for the venue map (the divs with ID 0,1,2,3) to not appear on the page.

    I'll introduce the work-around in 1.8.3, but this deals with the symptom rather than cause - are able to check if a particular plug-in or theme is causing this?

    Thank you!
    Stephen

  3. james.beard
    Member
    Posted 1 year ago #

    Happy to help Stephen.

    I'll strip back my dev site to see if another plugin or theme is conflicting.

    Can you please let me know what *should* be in divs 0,1,2 and 3? Just so I know where to start looking in the code.

    Also, do you remember what caused the similar problem previously, and what the fix was?

    Thanks
    James

  4. Stephen Harris
    Member
    Plugin Author

    Posted 1 year ago #

    I've introduced the above work-around in 1.8.4, but would still be good to find out what's causing this!

    The map handling is done via eo_get_venue_map() (see: https://github.com/stephenharris/Event-Organiser/blob/1.8.4/includes/event-organiser-venue-functions.php#L566)

    As you can see the map's details are stored in the static class' array EventOrganiser_Shortcodes::$map.

    Whenever eo_get_venue_map() is called, it collates the map details, stores it in that array and uses the count(EventOrganiser_Shortcodes::$map) to generate an ID.

    Its likely that another plug-in is causing eo_get_venue_map() to be called (probably via a shortcode) when the content isn't actually being displayed. As such as the ID count is being incremented, but the map isn't in the DOM.

    This is fixed in 1.8.4, but previously if the ID wasn't found in the DOM it would result in an error.

  5. elpezquemuerde
    Member
    Posted 1 year ago #

    I can't see the on event venue page:
    http://www.barrioportuense.es/actividades/lugar/cafeteria-milord/

    I read some post about this problem but don't work anything...

    Any idea?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags