Home › Forums › Calendar Products › Events Calendar PRO › Google maps 'Near' search – UK locations
- This topic has 14 replies, 3 voices, and was last updated 8 years, 11 months ago by Leah.
-
AuthorPosts
-
January 5, 2015 at 6:21 am #928715Rob KinnearParticipant
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
January 5, 2015 at 6:41 am #928721Rob KinnearParticipantHere’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…
January 5, 2015 at 12:06 pm #928936BrookParticipantHowdy 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
January 5, 2015 at 12:15 pm #928943Rob KinnearParticipantOk – 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…
January 5, 2015 at 12:17 pm #928944Rob KinnearParticipantOne 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..?
January 5, 2015 at 3:42 pm #929051BrookParticipantOk – 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
January 5, 2015 at 3:56 pm #929056Rob KinnearParticipantOk 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!January 6, 2015 at 12:00 pm #929479BrookParticipantThis reply is private.
January 6, 2015 at 12:10 pm #929481BrookParticipantThis reply is private.
January 6, 2015 at 3:21 pm #929552Rob KinnearParticipantThis reply is private.
January 8, 2015 at 7:37 am #930441BrookParticipantThis reply is private.
January 8, 2015 at 7:53 am #930447Rob KinnearParticipantThis reply is private.
January 8, 2015 at 8:18 am #930467BrookParticipantThank 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
April 24, 2015 at 10:20 am #958123BrookParticipantSince 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
May 28, 2015 at 11:54 am #965772LeahMemberHi 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 -
AuthorPosts
- The topic ‘Google maps 'Near' search – UK locations’ is closed to new replies.