Add a ‘find the nearest shop/dealer/….’ to your site in a mather of minutes with this umbraco package.
- Full control over the output (using xslt)
- Easy to customize
- Supports multiple domains and multilingual sites
Example of implementation (early screencast and demo at http://lab.nibble.be/):
Using the package:
After installation the first thing you need to do is to setup the Nibble.Umb.Locator.config file. This can be done be editing the file or you can also do this in the settings of the Locator datatype that should have been added by the installer.
The config file is basicly just used to store the different google maps api keys.
Once this is setup the next step is to add a results page (or alternative template), this is the page where the search result will be displayed.
On that template you’ll need to add the Locator macro
There are several parameters:
- XPath: here you’ll need to supply some xpath that will select the nodes you want to include in the search
- Location Alias: if the coordinates are stored on the nodes you can supply the alias of the property (you can use the included locator datatype, or it should also work with Darren’s map/place datatype)
- Use Address: if the coordinates are not stored on the nodes but you want to use the address instead, set this to true (this is only recommended when you don’t have a lot of nodes to search)
- Address Aliases: when you have the Use Address set to true, you’ll need to supply the alias of the property wich contains the address, when the address is in multiple properties you need to supply a semicolon seperated list
- Results Xslt: by default the package installs a xslt file this is used to transform the results, if you want to use another one, just speficy the name
Address Extra: if you only want to search in a certain region, you can specify a string that will be appended to the user’s search (so for UK you would append , UK)
- Unit in Km: if you want the distance in KM instead of miles …
- Multiple Results Caption: if there are multiple results found for the location that is entered by the user he will be presented with a radio button list where he’ll have to choose the correct one.
Both Address Extra and Multiple Results Caption support use of dictionary items (so you can use #itemname).
With the marcro in place the final step if to setup a form that will post to the page containing the macro.
<form method=”get” action=”/dealers/LocatorResult.aspx”>
<label for=”s”>Address/postcode: </label>
<input type=”text” name=”s” />
<label for=”s”>Radius: </label>
<option value=”0″>Please select</option>
<option value=”100″>100 miles</option>
<option value=”1000″>1000 miles</option>
<option value=”10000″>10000 miles</option>