The classic flow: the form saves the search and sends the visitor to the result page with a search ID in the URL.
On stores/result:
Template
{exp:reinos_maps_locator:search_form
channel="stores"
result_url="stores/result"
}
<input type="text" name="location_field" value="{location}">
<select name="radius_field_max">
<option {if radius == 25}selected{/if} value="25">25 km</option>
<option {if radius == 50}selected{/if} value="50">50 km</option>
</select>
<select name="search_type_field">
<option {if search_type == 'radius'}selected{/if} value="radius">Radius</option>
<option {if search_type == 'locality'}selected{/if} value="locality">Within a city</option>
</select>
<input type="submit" value="Search">
{/exp:reinos_maps_locator:search_form}Template stores/result
{exp:reinos_maps_locator:search_result limit="10"}
{if no_results}No result{/if}
<a href="{path='stores/detail/{url_title}'}">{title}</a>{if distance} ({distance} {distance_unit}){/if}<br>
{paginate}{pagination_links}{/paginate}
{/exp:reinos_maps_locator:search_result}Build it in your own site
What this example needs in ExpressionEngine, step by step.
- Install Maps Locator and Maps.
- Create the field, with these short names:
Short name Type Notes store_locationMaps Set the field setting Mode to Single location: one marker per store, placed with the search field. Maps Locator indexes that marker, so this one field is the location for the map and the search. - Create the channel
stores(Stores) and assign the field. - In the settings of Maps Locator, turn on Reverse geocoding: a marker of a Maps field is saved as a coordinate, the reverse geocoding looks up its address and city (the city pages and a search on a city need them).
- Put the code in a template.
- Put the code of
stores/resultin the templatestores/result. - Add a few stores (the demo site has 34 bike stores in the Netherlands).
This example comes from the Maps Locator docs: the preview runs exactly the code above.