Nibble

New Package - Locator

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.

locatordatatype

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

locatormacro

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”>
            <fieldset>
                 <label for=”s”>Address/postcode: </label>
                
                <input type=”text” name=”s” />
                
                 <label for=”s”>Radius: </label>
                <select name=”radius”>
                <option value=”0″>Please select</option>
                <option value=”100″>100 miles</option>
                <option value=”1000″>1000 miles</option>
                <option value=”10000″>10000 miles</option>
                </select>
 
 
                <button type=”submit”><span>Go</span></input>
            </fieldset>
        </form>

 

You can download the package on Our Umbraco (Umbraco’s new community site), sourcecode is available on codeplex.

16 Comments so far

  1. Petr Snobelt on June 25th, 2009

    Great work, as usual.
    Thanks for fantastic package.

    Petr

  2. Danny Douglass on June 25th, 2009

    Well thought-out and implemented package. Thanks!

  3. baris ozer on January 15th, 2010

    Hi Tim;

    I can install this pac but this error

    Server Error in ‘/’ Application.
    ——————————————————————————–

    Keyword not supported: ‘datalayer’.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Keyword not supported: ‘datalayer’.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: Keyword not supported: ‘datalayer’.]
    System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) 4907604
    System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) 98
    System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) 55
    System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) 24
    System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) 200
    System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) 62
    System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) 4
    System.Data.SqlClient.SqlConnection..ctor(String connectionString) 24
    Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) 54
    AppStract.umb.DataTypes.GoogleAddressPicker.GoogleAddressPickerPrevalueEditor.get_Configuration() 223
    AppStract.umb.DataTypes.GoogleAddressPicker.GoogleAddressPickerDataType.get_DataEditor() 135
    umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption) 86
    umbraco.controls.ContentControl..ctor(Content c, publishModes CanPublish, String Id) 780
    umbraco.cms.presentation.editContent.OnInit(EventArgs e) 368
    System.Web.UI.Control.InitRecursive(Control namingContainer) 333
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 378

    install runway and this pack (also installed google maps datatype pack).
    how to import this pack location to templates?
    Regards,

  4. stc on June 8th, 2010

    Hi Tim, I was just wondering, could you please suggest the best solution to this problem I’m having…

    I have a just inside the tag on my masterpage (I have to for another website search textbox element which is an ascx control that works upon enter keypress - solved that just by style=diplay:none hidding the button beside it)…however, for locator, you again need to use a form to submit the “s” query string parameter…but since inside the main server-side form I have also other elements which seem to instruct that main server-side one to resubmit via post to samepage adding only “?” the page just refreshes when clicking the locator button (returning me to “locatorpage.aspx?” instead of “locatorpage.aspx?s=searchstring”).

    I had changed the input button to “”…and that kinda seemed to solve the problem in the sense that then the first locator submit button click worked…however it stopped my other elements from working (namely the website search textbox which should submit upon enter keypress -> made to work by just a hidden submit button beside it - maybe that’s a wrong approach?!) and also didn’t work when there was multiple search results returned. Choosing one radio button and clicking “ok” just seemed to refresh the page again.

    Anybody had this problem? What’s the best fix? Ieframe loading this locator as a separate page?! TIA

  5. jinxen on January 18th, 2011

    Hi,

    After upgrading to umbraco 4.6.1 the package stopped working and is now only displaying “Error displaying locator results”. Have you experienced the same issue?

  6. Mick on January 19th, 2011

    Yeah getting the same issue

    Error displaying locator results

    in 4.6 any clues?

  7. Tom Fulton on April 28th, 2011

    You most likely need to update LocatorResults.xslt to use the new schema - the updated file is on codeplex

  8. fettverbrennungsofen on September 2nd, 2012

    Superb, what a webpage it is! This webpage provides useful information
    to us, keep it up.

  9. Yik on October 10th, 2012

    Do I have to go to google to generate my own google Map API Key or i can use the pre-installed one?

  10. mithun on November 8th, 2012

    the package working correctly in our site,but some postcode search results are not shows correct result.Some time it shows correct result .we need a solution on this.. Please help

  11. mithun on November 10th, 2012

    the top 10 nodes working correctly remaining are the problem.Any type of filtering which done in xslt?

  12. tOM on September 12th, 2013

    Hi I was just wondering if you had this working as the new google maps api has broken the package to the point where it no longer retrieves results. We get a 403 forbidden

    Thanks,
    Tom

  13. Tim Geyssens on September 12th, 2013

    @tOM use the latest version http://www.nibble.be/?p=263 (the one you are using still uses the old google maps api)

  14. Jamie on September 26th, 2013

    Hello,

    I wanted to try Seek & Destroy however it seems it needs v 6.1 or higher, I need to install it on a 4.7.1 site.

    Will this locator package still work with the new Google Maps API?

    Cheers,
    Jamie

  15. Tim Geyssens on September 26th, 2013

    @Jamie try the razor version http://www.nibble.be/?p=105

  16. Бързи заеми и всички видове бързи
    кредити
    Сайт за бързи заеми и потребителски кредити
    в България
    Пари назаем до 24 часа с бърз кредит
    В този уеб сайт ще намерите списък на фирми предлагащи бърз заем,
    в които получавате парите до 24 часа, предложения за бърз потребителски кредит над 399 лв,
    както и актуални промоции
    , списък с офисите на компаниите по градове, микрокредити за малкия бизнес, удобен филтър за бързо намиране на
    най-добрата оферта, калкулатор,
    услуги с изцяло онлайн процес за кандидатстване и взимане на парите, полезна информация.

    Feel free to visit my site … бързи кредити от банки

Leave a Reply