Support » Plugin: WP Store Locator » Adding TONS of locations – Grid or Preload less markers

  • Resolved Simone

    (@simonttz)


    Hey, first of all GREAT plugin, thank you so much for making it!!

    I am trying to add a few thousand locations to my map… Is this feasible? Currently I have several hundred locations added to my map, it loads fine on desktop but it causes Safari to crash on iOS.

    I found this:
    https://developers.google.com/maps/articles/toomanymarkers

    Not sure how easy/feasible it would be to implement this? I have consulted a development team and they said it would take 15+ Hours. :/

    My question is, is there a way I can simply load the 10 nearest locations to the user by default, instead of loading up EVERY single location listed on the map?

    Thank you so much, I look forward to your reply.

    https://wordpress.org/plugins/wp-store-locator/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    If you go to settings -> Markers -> Enable marker clusters then it will merge markers together is they are close to each other.

    Limiting the max location load is something you would need to hard code for now ( this will be an option on the settings page in the next version ).

    If you open the /frontend/wpsl-ajax-functions.php, then replace the code from line 26-31 with this ( untested ).

    $sql_part = ' ORDER BY distance LIMIT %d';
    $placeholders = array(
       $_GET["lat"],
       $_GET["lng"],
       $_GET["lat"],
       '10'
    );
    Simone

    (@simonttz)

    Hi Tijmen

    Thank you so much for your prompt response.

    However, I am not sure this feature (Marker Clusters) is working for me. I enabled it and don’t see a noticeable difference.

    Can you please have a look!

    http://www.corenatural.com

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Have you tried different values for the “Max zoom”?

    This is with level 13Max

    This is with level 8Max

    They are still not showing in clusters even though I have enabled it in the back-end. I am using the latest version of the plugin
    http://i.imgur.com/qH0Lygu.png

    Hmm I wonder what It could be …

    I appreciate all your help on this

    Plugin Author Tijmen Smit

    (@tijmensmit)

    There are js errors on your site which I should have noticed before, the first one is this, ‘Error: Permission denied to access property ‘document'” followed by one from the cluster marker script. But maybe the first one results in the second error.

    From what I found that message has something todo with iframe code. And you do have an iframe on that page, which I think comes from the gravity form plugin.

    Could you try to disable the gravity form plugin and see if that makes the cluster markers work?

    I have deactivated Gravity forms and also easy fancybox which the form was being called in (lightbox)

    still it doesn’t seem to work

    I am still seeing some errors in console

    Uncaught TypeError: number is not a function markerclusterer.min.js?ver=3.8.5:5

    Thank you for your continued support with this!! (y)

    Plugin Author Tijmen Smit

    (@tijmensmit)

    That is a different error then before.

    Can you try to disable all plugins for a second, except the store locator and see if it works then? Or for a second switch back to the default wp theme? There is a conflict somewhere that breaks it, just not sure where it’s coming from.

    Hi Tijmen

    I have found out that it was an issue conflicting with the social stream plugin

    Do you think I should disable a certain script in this plugin? this plugin is required for the site but we need it to work

    i am seeing this error in console:

    markerclusterer.min.js?ver=3.8.5:5 Uncaught TypeError: number is not a function

    What do you think?

    Thank you so so much.. Happy Holidays!!

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Switching to another theme for a second and keeping all plugins active and then keeping the marker clusters activated also breaks it?

    I installed the social stream plugin as well and enabled the marker clusters, and it did work for me. So maybe it’s a combination with your theme and the social stream plugin?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    There is another alternative. The marker cluster js file is minified, so it’s impossible to see on which line it breaks.

    If you open the /frontend/class-frontend.php then search for this line, and remove the .min from the file path.

    wp_enqueue_script( 'wpsl-cluster', WPSL_URL . 'js/markerclusterer.min.js' );

    Then enable the marker clusters again to trigger the error, open the console and you should see a line number. I like to know the line number it says 🙂

    It seems to be working now!

    Thank you so much

    Removing “.min” from that line was what did the trick!

    Plugin Author Tijmen Smit

    (@tijmensmit)

    It’s a bit weird that this fixed it.

    As far as I know a minified version is either broken for everyone or it works for everyone. I still think something else on your site caused it to break, but it’s good to hear that it is fixed now!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Adding TONS of locations – Grid or Preload less markers’ is closed to new replies.