Reinos.nl internet media examples

Open now: locator tag

Maps Locator 4.0.1 Live

open_now_filter="yes" adds the checkbox to the form. The list shows Open now, until 17:30 or Closed, opens tomorrow at 09:00 by itself; with {locator:results} as a tag pair you write that part yourself:

  • {has_hours} tells a store without opening hours apart from a closed store.
  • {opens_day} is today, tomorrow or the name of the day; {opens_at} is empty when the store doesn't open within a week.
  • Use open_now="yes" instead of open_now_filter="yes" for a list of only the stores that are open now, without a checkbox.
Template
{exp:reinos_maps:html_header}

{exp:reinos_maps_locator:locator
    channel="stores"
    open_now_filter="yes"
    radius_options="10|25|50"
    time_format="g:i a"
}
    {locator:form}
    {locator:status}
    <div class="maps-locator__body">
        {locator:results}
            <h3 class="maps-locator__title"><a href="{path='stores/detail/{url_title}'}">{title}</a></h3>
            <p class="maps-locator__address">{address}</p>
            {if has_hours}
                <p class="maps-locator__hours maps-locator__hours--{if open_now}open{if:else}closed{/if}">
                    {if open_now}
                        Open, closes at {closes_at}
                    {if:elseif opens_at}
                        Closed, opens {opens_day} at {opens_at}
                    {if:else}
                        Closed
                    {/if}
                </p>
                {if hours_today}<p class="maps-locator__hours">Today: {hours_today}</p>{/if}
            {/if}
        {/locator:results}
        {locator:map}
    </div>
{/exp:reinos_maps_locator:locator}

{exp:reinos_maps:html_footer}

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 a template.
  6. 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.