Q281: I HAVE RESOURCES IN A NUMBER OF GEOGRAPHIC LOCATIONS. CAN MY CUSTOMERS DO A GEOLOCATION SEARCH WITH Checkin24-7?

Vous êtes ici: checkin24-7 » Aide » Questions Fréquemment Posées (FAQ) » Q281: I HAVE RESOURCES IN A NUMBER OF GEOGRAPHIC LOCATIONS. CAN MY CUSTOMERS DO A GEOLOCATION SEARCH WITH Checkin24-7?
Yes, this is supported, for both single sites and metasites. Your visitors can use the geographic location as one of the search criteria. The way this works is that they enter a location and a maximum radius. Only the resources within this distance will be returned in the results. The location can be entered either as the current position (this will work very well with mobile devices/tablets but may also work with desktops) or by clicking on Choose on map which opens a lightbox where the customer can either enter the address into an address box or they can also click on the map to specify the location visually.


Search form including the geolocation feature

As an extra feature, in the search results you can show all results on a map. To do this, go to the search results template and add the $(goog_map_results) tag (or another similar map tag).


Search results including a map

In order to use this feature, you must go to Site settings / Custom resource properties and add a new GPS coordinates item. In the Possible distance choices field, enter the search radius choices the user can select from. For kilometers use the km postfix, e.g. 1km, 10km, 20km and for miles m or miles, e.g. 1 mile,5 miles,10 miles. You also need to specify your Google Maps API key so we can load the Google Map widget. You can request the API key (called "browser key") in your Google account (visit https://console.developers.google.com/). We use the Google Maps JavaScript API v3 service. You can read more about Google Map API keys here. Note that it is recommended that you secure your key by adding a restriction. See the link above for more information about this.


Adding a GPS coordinates property in Custom resource properties

Once you enter the new resource property definition into your checkin24-7 site or metasite, you should specify the geographic location of all your resources. You can do this in each resource's settings but it's more convenient to click on Batch edit property.

Now the last thing to do is add the geolocation criterium to your search box. Please follow this tutorial to find out how to add custom resource properties to your search box, whether working with a search box widget or the search mode in the checkin24-7plugin.

In your search results template, you can use the tags $(geolocation_distance) and $(geolocation_distance_miles) to show the distance from the location chosen for each of the results. It's also possible to sort the results by this distance.