Google Maps Javascript stops working if Ajax Search is present

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Google Maps Javascript stops working if Ajax Search is present

This topic contains 13 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 4 years, 7 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #15721
    otuxe
    otuxe
    Participant

    Hi!

    I have the following problem. When I add Ajax Search to the same website with Google Maps, all the markers on the google map will load up just fine. However, when I filter the markers, all of the markers will disappear.

    I have tried debugging, nothing is wrong, there are no error messages. The whole page is hard-coded. When I replace Ajax Search shortcode with other shortcodes, the whole map will function as it should. The website will stop working regardless of the location or way the ajax search is called.

    What could be the reason for this?

    If you need any more information, please let me know.

    Thank you!

    #15722
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I have looked at the page source, at first sight I would say that one major issue is that the jQuery script is included 3 times.
    The first one in the header is the correct one, as it’s enqueued by WordPress, but there are two more instances within the middle of the page (on line 375 and 379 on the main page source). I have copied that section here, see lines 1 and 5, both loading jQuery 2nd. and 3rd. times:

    I would suggest removing those first, and making sure that any custom script is enqueued properly.

    This may not be the exact cause though, but it’s worth fixing first.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15723
    otuxe
    otuxe
    Participant

    Thank you for the suggestion! I have removed those duplicate instances. Sadly, it does not solve the issue. Is there anything else I should try?

    Thank you in advance!

    #15724
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Well, I’m not sure, but maybe changing these two options on the Compatibility Settings submenu: https://i.imgur.com/0QMWdPN.png

    These are just wild guesses, it can be something completely different – like a syntax error somewhere, something with the integration or something similar. Can I somehow test the issue? If you can add temporary back-end and FTP details, and steps on how exactly I can replicate it, I may be able to solve it.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15725
    otuxe
    otuxe
    Participant
    You cannot access this content.
    #15726
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    You are welcome 🙂

    Can you please check the back-end log-in details? It says that the password is not correct for that username. Thank you!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15729
    otuxe
    otuxe
    Participant
    You cannot access this content.
    #15730
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15731
    otuxe
    otuxe
    Participant
    You cannot access this content.
    #15732
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15733
    otuxe
    otuxe
    Participant
    You cannot access this content.
    #15734
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thanks, this one works!

    I may have found the problem, but I can’t open files via the FTP account you sent, so I could not test a solution.

    Basically there is an error within a custom code on the page within the updateView() function declaration, on this line:

    checkedBoxes = ([...document.querySelectorAll('input[type=checkbox]:checked')]).map(function(o) { return o.id; });

    This line means, that it maps all the checkboxes found on the page, which also includes the checkboxes within the search form, or anything at all, even invisible ones.

    My suggestion to fix that would be to make the query more specific, like so:

    checkedBoxes = ([...document.querySelectorAll('#options input[type=checkbox]:checked')]).map(function(o) { return o.id; });

    This will make sure that the selection only affects the checkboxes which are contained by the element with the ‘options’ ID.

    I hope this helps!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15735
    otuxe
    otuxe
    Participant
    You cannot access this content.
    #15736
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I’m glad I was able to help you out 🙂

    Actually, if you could rate the plug-in codecanyon downloads page, it would help me a lot.

    Thank you again for your kind words! I will leave this topic open for a few days, then close it and mark it as resolved, if nothing comes up.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.