Highlighting Locations Served By Territory

Version 4.5 of the Premier Add On for Store Locator Plus introduces territories to locations.

Once a location is setup with a territory the map markers that are sent back from the server during a user search will include a ‘in_territory’ property set to ‘1’ if the user’s location is within the territory and ‘0’ if not.   An additional ‘in_territory_class’ property will also be set to either ‘in_territory’ or a blank string.   Both settings are part of the ‘data’ property of the location marker.

If you are using the Experience add-on you can display either setting with the [slp_location data.<property>] shortcode.  For example [slp_location data.in_territory_class].    You can add this to an HTML element to add the “in_territory” class to results and thus format your results layout to highlight locations where the user falls within their territory.

A location will always return “user’s location is not served by this store” (not in territory) if any of the following is true:

  • The Territory Distance Unit setting is ‘None’ for that location.
  • There are not at least 3 distances set as the territory bounds from the location’s latitude/longitude.
  • A non-standard search is performed where the user’s latitude/longitude are not sent to the server.  Discrete searches send specific search strings NOT a user’s latitude longitude, for example ‘state = CA’.

Highlighting Locations Serving A User

You can use the in_territory_class along with the Experience add on features to highlight which locations service the user’s searched-for location.     In the example below the user searched for zip code 60560 which is within MJ’s territory but not within RJ’s territory.

Premier 4.5 Territory Results Highlight Example
Premier 4.5 Territory Results Highlight Example

Results Layout Setting

This is done by adding a [slp_location data.in_territory_class] to the pre-existing “class” portion of the default Results Layout setting.  The entire modified entry is shown here:

Custom CSS Setting

In addition a custom CSS rule is set under the Experience / View tab in the custom CSS box as shown here to highlight the in-territory entries in gold: