Nearest Location

You can determine the position of the website visitor.

Radialsearch stored both datas in the session:

  • the latitude and the longitude of the visitors position
  • the uid of the “nearest” record of a given table

Preconditions

  • The visitor has to allow to get his position
  • You have a table with records, which contains the latitude and the longitude

Setup

Include the static template

  • Radial Search [2.0] Nearest location

Constant Editor

Select

  • RADIAL SEARCH - NEAREST LOCATION

Enter

  • The name of your table
  • The name of the fields for title, lat, lon and location (like city)

Use the session data

// Get the uid of the "nearest" record of the given table
data = session: tx_radialsearch_pi1|nearestLocation|{$plugin.tx_radialsearch_pi1.nearestlocation.table}
// Get the latitude and the longitude of the user position
data = session: tx_radialsearch_pi1|userPosition|lat
data = session: tx_radialsearch_pi1|userPosition|lat