Reinos.nl internet media examples

Open now: your own form

Maps Locator 4.0.1 Live

The same with your own form, in the query string (method="get"). The checkbox open_now limits the search to the stores that are open now, {open_now} checks it again after the search:

With Open now checked and no store open within the radius, nearest="3" shows the 3 nearest stores that are open now.

Template
{exp:reinos_maps_locator:search_form method="get" result_url="stores/open"}
    <input type="search" name="location_field" value="{location}" placeholder="City or postal code">
    <label><input type="checkbox" name="open_now" value="1" {if open_now}checked{/if}> Open now</label>
    <button type="submit">Find a store</button>
{/exp:reinos_maps_locator:search_form}

{exp:reinos_maps_locator:search_result
    channel="stores"
    radius="25"
    nearest="3"
    limit="20"
}
    {if no_results}<p>No stores found.</p>{/if}
    <article class="store">
        <h2><a href="{path='stores/detail/{url_title}'}">{title}</a></h2>
        <p>{street_name} {street_number}, {city} &middot; {distance} {distance_unit}</p>
        {if open_now}
            <p class="store__open">Open until {closes_at}</p>
        {if:elseif has_hours}
            <p class="store__closed">Closed{if opens_at}, opens {opens_day} at {opens_at}{/if}</p>
        {/if}
    </article>
{/exp:reinos_maps_locator:search_result}

Build it in your own site

What this example needs in ExpressionEngine, step by step.

  1. Install Maps Locator and Maps.
  2. Create the fields, with these short names:
    Short nameTypeNotes
    store_locationMapsSet 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.
    store_hoursMaps Locator Opening HoursThe week and the exceptions (holidays).
  3. Create the channel stores (Stores) and assign the fields.
  4. 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).
  5. Put the code in the template stores/open: the code links to it.
  6. Add a few stores (the demo site has 34 bike stores in the Netherlands).
  7. Open /stores/open.

This example comes from the Maps Locator docs: the preview runs exactly the code above.