• Resolved James Jones

    (@jamesjonesphoenix)


    Hi there,

    I encountered a bug with your plugin. It’s related to the theme I’m using which obviously isn’t your problem, but please read carefully because you do have a problem in there somewhere.

    Clicking on some tabs supplied by my theme unrelated to your plugin breaks the Javascript. The actual js error is:

    MYMAP.modernStoreLocator.element is undefined

    The tabs have class .nav-tabs. So when I click the link InitMap() is invoked as per the wpgmaps.js line jQuery('body').on('click', '.nav-tabs li a', function(event, ui) { InitMap(); });.

    The actual js line triggering the error is MYMAP.modernStoreLocator.element.index = 1; in line 293 of wpgmaps.js.

    The thing is I have Store Locator switched off in the options. This code block should not be getting executed as far as I can see. I don’t understand why the variable MYMAP.modernStoreLocator exists when I have the Store Locator switched off but I didn’t trawl through the code to find out.

    I fixed it for myself by changing line 290 from if(MYMAP.modernStoreLocator) to if(MYMAP.modernStoreLocator && MYMAP.modernStoreLocator.element). The map continues working fine for myself. The actual fix is somewhere along those lines, but maybe less hacky.

    Hope that helps.
    Cheers,
    James

    • This topic was modified 5 years, 8 months ago by James Jones.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi James

    Thank you very much for the comprehensive report.

    This is confusing as your version of WP Google Maps on this site appears to be up to date, however based on what you’ve said, your JS doesn’t match ours.

    With that said, we’ve added an additional check for that element as per your advice, I think that’s the best way moving forward.

    We’ll need to test this to see that it doesn’t have any adverse affects elsewhere, however I think it’s quite reasonable to say we can keep this in.

    Is there anything else we can help you with?

    Kind regards
    – Perry

    Thread Starter James Jones

    (@jamesjonesphoenix)

    You’re most welcome and thanks for listening.

    I was using version 7.11.31. Your plugin recently updated to 7.11.32. If that file changed between versions it’d probably explain the discrepancy. Otherwise I’m not sure why.

    • This reply was modified 5 years, 8 months ago by James Jones.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug With JS Store Locator Code’ is closed to new replies.