• So we have the map limited to UK only, and for the main this works ok for example you can search “Paris” and it will show the alert at the top (which we would prefer to change to show what you get when you search “Belfast”) but that’s another topic.

    Anyway the issue is when you search a location such as “Hamburg” we get the map centered on the UK and it shows us a side panel result which has no reference to what we would of liked to have seen (either the same as “Paris” or what you see searching “Belfast”)

    Can someone advise how we can go about altering this behaviour and if its even possible?

    For the sidebar we use the “wpsl_no_results” filter in order to render the content there.

    In terms of all the settings we use these links are screenshots showing these:

    https://prnt.sc/PZbpri3uCoz5
    https://prnt.sc/HdL9yl877tYS
    https://prnt.sc/5V-ckYktP4tx
    https://prnt.sc/ZnYLdJstFMV1
    https://prnt.sc/r8wlR3GurOZ5

    Please let me know if you need any further information or details.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi!

    Thanks for reaching out and for sending your settings.

    Is there something wrong with the start point setting? There is a weird red symbol in the text field and I don’t know what it could be.

    As for the rest of your explanation, the behaviour is a bit weird, you are totally right. I assume that when you search “Paris”, Google cannot find any location with that name in the UK so it returns that alert. But when you search “Hamburg”, it defaults to the predefined middle-point for the UK in Google Maps, which makes me think that maybe there is some “Hamburg” location in the UK somewhere, but I am just guessing because I couldn’t find it.

    However, I was wondering if you would be willing to enable auto-complete in the settings, because this tends to solve this kind of issues that happen when you are restricting to a certain country but search locations outside of that country.

    With auto-complete turned on, you are shown suggestions as you type, and those suggestions will belong in the country that you are restricted to, so that could be a potential filter to avoid searches outside of the UK.

    Any thoughts?

    Thread Starter gsc89

    (@gsc89)

    Sorry for not coming back to you sooner about this, the starting point is set fine its input box is having a chrome extension affect it (lastpass) sorry for the confusion there.

    I am reviewing the other points such as turning on the auto complete, I am not the decision maker with some of these so I have to check in with them and come back with regards to if they work out as solutions.

    I am not sure why start point is London but no results tends to end up in Scotland so that’s a bit odd.

    Thread Starter gsc89

    (@gsc89)

    So to do some testing, I did turn on auto-complete but this doesn’t prevent issues happening, of course the auto complete now only shows UK addresses which is fine, but I suspect this isn’t going to be good for times where we want to show information to a user where they search outside of the UK which we do.

    Also auto complete doesn’t prevent invalid entry, for example you can still type out “Paris” hit enter ignoring the suggestions and then do the same for “Hamburg” and end being centered in St Andrews gold course with side result info about “Isle of man Prison” so I’m not sure what causes that issue.

    Do you have any other suggestions or can I give you any more info about this to debug further?

    Hi again,

    Here is something funny I found out. If you have your map restricted to the UK and try doing a raw Google Maps API search (you can try in Wp Store Locator settings page, near the end, the button labeled “Input location details”), here is what happens when you search for “Hamburg” (see screenshot).

    So, it turns out, Google returns a point in the UK when you search for “Hamburg”. On the contrary, this is what happens when you search for “Paris” (see screenshot).

    Paris returns zero results. This is why the plugin behaves differently in each case. For the first search it takes the point that is returned by Google Maps as the start point, and for the second search it doesn’t have a start point and it returns that alert message.

    Unfortunately this looks as an error fro the Google Maps geocoding API, and this is beyond our control.

    of course the auto complete now only shows UK addresses which is fine, but I suspect this isn’t going to be good for times where we want to show information to a user where they search outside of the UK which we do.

    This is something I don’ t understand, though. If you are restricting the results to UK only, why would you want to show information to a user when they search outside of the UK, if you don’t have any stores there?

    Also auto complete doesn’t prevent invalid entry, for example you can still type out “Paris” hit enter ignoring the suggestions and then do the same for “Hamburg”

    This is true, users can still type anything and hit enter, but with autocomplete on, chances of this happening are lower, users tend to choose one of the results from the suggested locations in our experience.

    In any case, I understand any of this solves your problem, but at least the “Hamburg” vs “Paris” thing has a root cause in Google’s own geolocation services. Google has some feedback pages that you can use to report errors in their maps, maybe you can try submitting this issue.

    Any thoughts?

    Thread Starter gsc89

    (@gsc89)

    I will review this and come back to you just the point about “outside UK searches”

    This is something I don’ t understand, though. If you are restricting the results to UK only, why would you want to show information to a user when they search outside of the UK, if you don’t have any stores there?

    So the reason for this is that when someone searches outside the UK we want to show them a message that says “to get help internationally you can contact xtz…” type thing.

    I will review the rest of your response asap and come back to you, that’s the reason for outside the UK searches though.

    We use a filter for this. wpsl_no_results and edit the HTML to show different contact options from outside the UK.

    Hi again,

    Ok, I understand your use case better now, thanks. Please review my response as well as the Google Maps raw API data and get back to us whenever you want 🙂

    Regards,

    Thread Starter gsc89

    (@gsc89)

    Thanks for letting me know about that testing section its useful to know thanks, I see what you mean about the API returns now, this is very strange behaviour and obviously outside of your control.

    The only other thing that sort of bothers me is that we set the default location / start location to be London but when searching a string that returns no results for example “Test” it will put the marker in Scotland, is there a method of maybe picking the map placement in this event?

    Thanks for your help thus far it’s been appreciated.

    Hi again,

    Well, I understand this behaviour is also bothering you. The thing is, that point in Scotland is what Google defaults to when you search for “United Kingdom”, which is your geographic area of choice.

    If you just go to plain-old Google Maps and just search “United Kingdom”, and then you try to search for directions to get there, you get exactly the same destination point in the map (see screenshot).

    So, for some reason, Google thinks this is the “middle point” in the UK when it lacks a specific location, so it defaults to that. Why? Honestly I have no idea. It sucks, but unfortunately this is also beyond our control.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘No results behaviour – centers the map on a non location’ is closed to new replies.