Google maps 'Near' search – UK locations

Home Forums Calendar Products Events Calendar PRO Google maps 'Near' search – UK locations

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #928715
    Rob Kinnear
    Participant

    Hi. I posted another discussion on this a couple of months ago (but can’t find it on the new site!). The answer given was that there was nothing that could be done because of the way Google passes map information. That’s fine, but was after some advice about how I might be able to use the search feature better here in the UK…

    My problem is that on the map view, the “Near” search field is populated by cities in America first (when you enter a city like Cambridge and press ‘Find Events) and there is no scroll bar to go futher down the list to find ones in the UK (I presumed that I would get UK addresses listed first because of my geographioc location but this isn’t happening). Our site is a ‘What’s on’ guide to the East of England and so people need to search for cities like Cambridge or counties like Norfolk. Unluckily for me there are lots of other cities/places in America for both these places and it’s impossible to do a search for these very important locations without adding UK at the end which seems very clumsy.

    Is there anything I can do to ensure the populated list puts UK places to the top? Failing that, is it reasonably easy to rename the labels ie change “Near” to “Your Postcode” as the Zip/Postcode will work ok…

    Thanks

    #928721
    Rob Kinnear
    Participant

    Here’s another idea – can the ‘Search’ field be changed to also search the address for each event as this would mean I could hide the “Near” label (or change to postcode only) and get the results I need…

    #928936
    Brook
    Participant

    Howdy Rob,

    My problem is that on the map view, the “Near” search field is populated by cities in America first (when you enter a city like Cambridge and press ‘Find Events) and there is no scroll bar to go futher down the list to find ones in the UK

    That’s a good idea. I would think the UK would be listed at the top too, because Google is quite clever about such things. Unfortunately they’re not being clever here. I do not believe there is anything you can do to influence the order of the results they return there.

    Failing that, is it reasonably easy to rename the labels ie change “Near” to “Your Postcode” as the Zip/Postcode will work ok…

    That is totally possible. Using a snippet like this one you can change the wording of anything. Just paste it into your functions.php file, and modify it as instructed.

    https://gist.github.com/elimn/48b04dc1754bd99e91ad

    Here’s another idea – can the ‘Search’ field be changed to also search the address for each event as this would mean I could hide the “Near” label (or change to postcode only) and get the results I need…

    That is also a really good idea. Super complicated to bring about though. You’d need to tap into the search query and modify it to include location search logic. You’d also need to recognize on the front end what’s an address and what’s not, probably by Google’s API response. Lots of SQL and JS knowhow will be involved in making that happen.

    Please let me know if you have further questions! Do one of those solutions work?

    – Brook

    #928943
    Rob Kinnear
    Participant

    Ok – the only other thing I can think of (trying to pre-empt my discussions with the client later in the week!) would be to introduce a dropdown list of counties this would give the user a set list of areas to try… Would it be fairly easy to add a drop down menu above the search bar using functions? I could create a custom menu using urls that search for specific areas…

    #928944
    Rob Kinnear
    Participant

    One last try 🙂 could the “Near” field have UK automatically inserted after it and the fly out list of places disabled? This would mean that if a user searched for Cambridge, it would automatically use Cambridge+UK and hitting search would bring up the results..?

    #929051
    Brook
    Participant

    Ok – the only other thing I can think of (trying to pre-empt my discussions with the client later in the week!) would be to introduce a dropdown list of counties this would give the user a set list of areas to try… Would it be fairly easy to add a drop down menu above the search bar using functions? I could create a custom menu using urls that search for specific areas…

    Totally possible. The WP Filter ‘tribe-events-bar-filters’ contains an array, each being a filter in the Tribe Bar. One of them is location search. You either disable Location search from the backend and append your drop down as a new array item, following the format of the existing ones (which you could inspect with a debugger or by using var_dump on that array). Or you replace the location search’s HTML with your drop down. All location search does is geocodes the address you input into lat/lng and then submits them as <form method=”get”> elements. So a search for london forwards you to a URL like this:

    /events/?action=tribe_list&tribe_paged=1&tribe_event_display=list&tribe-bar-geoloc-lat=51.5073509&tribe-bar-geoloc-lng=-0.12775829999998223&tribe-bar-geoloc=London%2C+UK

    So a fairly simple pure HTML form could be create with your counties hardcoded in there! But, it is not actually searching the country. Rather it is search for events within 50 miles of that lat/lng. You can adjust the distance with the filterbar plugin if needed.

    One last try :) could the “Near” field have UK automatically inserted after it and the fly out list of places disabled? This would mean that if a user searched for Cambridge, it would automatically use Cambridge+UK and hitting search would bring up the results..?

    That does not sound possible with any measure of ease. You would have to do lots of trial and error JS to accomplish this.

    Does that all make sense? I am happy to clarify if I can.

    – Brook

    #929056
    Rob Kinnear
    Participant

    Ok thanks I think the drop down option looks the most promising at the moment. Before I give up for the night, I found this article which I wondered whether it might help – it shows how to set bounds on the google api. I saw that the js file in your plugin had code similar to this and wondered if you thought this might work… http://stackoverflow.com/questions/9131236/google-maps-api-autocomplete-bound-to-uk-only
    Sorry to keep bugging you but it would be great if I could get this to work!

    #929479
    Brook
    Participant

    This reply is private.

    #929481
    Brook
    Participant

    This reply is private.

    #929552
    Rob Kinnear
    Participant

    This reply is private.

    #930441
    Brook
    Participant

    This reply is private.

    #930447
    Rob Kinnear
    Participant

    This reply is private.

    #930467
    Brook
    Participant

    Thank you! You are unfortunately using a different portion of the API than us. Autocomplete versus geocode. But, I will still pass it on. I appreciate your pointing this out Rob. Sorry it took so much back and forth for me to determine that this was a bug. It’s definitely one we’d be interested in fixing if we can. Unfortunately it might be a few releases because it is fairly low impact when weighed against bugs that affects all locations.

    In the mean time, you can override tribe JS files by using our themer’s guide. But, you’d likely need to reapply your JS each time you update even doing this, because we update those JS files almost every release. So while your JS file would persist between plugin updates, it might break the site since the rest of the JS file would be based on an outdated version of TEC. I hope that makes sense, kinda tough to explain.

    Thanks again for your help. I’ll mark this topic to be notified of any developments in our bug trackers regarding this.

    Is there anything else I can do to assist you? If not, mind marking this resolved? Cheers!

    – Brook

    #958123
    Brook
    Participant

    Since this topic has gone for a spell without any updates I am going to archive it. Please feel to open a new topic though if you still need assistance. We would love to help.

    Cheers!

    – Brook

    #965772
    Leah
    Member

    Hi there,

    Thanks again for your post. We wanted to get in touch and let you know that although we weren’t able to address this issue in our upcoming 3.10 release, it is still very much a priority. We have a ticket in our system and will be investigating a solution for a future version. Thank you for your patience and support while we work on this!

    Cheers,
    The Events Calendar Team

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Google maps 'Near' search – UK locations’ is closed to new replies.