Skip Navigation

[Resolved] Map Markers on Search View

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to show a custom search View with a distance filter and a map with markers showing the results. I would like to use the visitor's location in the distance calculation. When I load the page, no results appear on the map. I am developing my site and I currently use HTTP but expect to integrate HTTPS.

Solution: User location requires HTTPS. Once that is set up, the map will automatically display results if the User allows access to their location in the browser. If the User blocks access, no results will be shown until some other location is entered as the basis for the distance calculation.

Relevant Documentation:
https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#filtering-markers-by-distance

This support ticket is created 5 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by jeffreyS-6 5 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1156476

I am working on a new site for a client who has a dealer locator. I am trying to get to function as needed before I make it look pretty.

But the problem I am having is I can get the search to work and display the map markers when you perform a search. But when I just visit the page, no map markers display on the map. Is it possible to have the location load on the map when the view is loaded? If so, am I doing something wrong?

The link to the page I am developing can be reached here: hidden link . I only have two locations in the database at this point. When I do a search, everything works as needed. I just need the page to load with dealer locations on it. I plan to have it load the location of the visitor once I have the site live with https enabled. Is everything I want to do possible?

This is the code I have in the Loop Editor:

[wpv-layout-start]
[wpv-items-found]
[wpv-map-render map_id="map-2"]
<!-- wpv-loop-start -->
<div class="container wpv-loop js-wpv-loop">
<wpv-loop wrap="4" pad="true">
[wpv-map-marker map_id='map-2' marker_id='marker-2' marker_field='wpcf-address'][/wpv-map-marker]
[wpv-item index=1]
<div class="row ">
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-dealerlocator"]</div>
[wpv-item index=2]
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-dealerlocator"]</div>
[wpv-item index=3]
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-dealerlocator"]</div>
[wpv-item index=4]
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-dealerlocator"]</div>
</div>
[wpv-item index=pad]
<div class="col-sm-3"></div>
[wpv-item index=pad-last]
<div class="col-sm-3"></div>
</div>

</wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

I love toolset. It save me a ton of time! I appreciate your help!

#1157320

Hi, when you have HTTPS active the map will automatically include results within the radius you specify from the current User's Location, assuming the User allows location access. There is a slight delay after the User confirms access to location services, then the map will update to show the matching results. However, if the User blocks access to their location, then the map will continue to display no results until the User enters some location to use as the basis of the distance calculation.

#1157906

Thank you... that makes sense!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.