Skip Navigation

[Waiting for user feedback] I fixed a bug with the toolset maps autocomplete, thought you might want the fix

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 1 voice.

Last updated by Christopher Amirian 5 days, 5 hours ago.

Assisted by: Christopher Amirian.

Author
Posts
#2850389

Something that has been driving us nuts with Toolset's google maps is that when we have a location field where someone can type in their city and state, country, the dropdown might suggest

Long Branch, NJ, USA

But when we select it, the field populates with

Long Branch, NJ 07740, USA

And there is absolutely no way to remove the ZIP code. And this only happens with like 1 out of 300 addresses.

We traced it down to a problem with Google! Their API isn't consistent when it returns the 'formatted_address' field. 99% of the time, it's correct, but sometimes ZIP codes sneak in there.

So we wrote our own fix to
plugins/toolset-maps/resources/js/jquery.geocomplete.min.js

Right now we're patching it with a redirect on our end, but ideally toolset would roll out a fix like this in a future release. I thought we'd just give you our fix in case it helps.

This is de-minified, fixed, and extensively commented:
hidden link

#2850429

Christopher Amirian
Supporter

Languages: English (English )

Hello,

Thank you very much for sharing the patch code. I will ask our development team about this.

Just as my educated guess, the chance that this will be patched is slim, as there is a strict internal code standard that we should not mess with 3rd party API results.

I understand that the patch is fixing something that is broken in Google.

May I ask you if you use OpenStreet you found the same problem?

Thanks.

#2850869

Hi, we didn't try open street, only the google maps API.

#2850957

Christopher Amirian
Supporter

Languages: English (English )

Got it thanks. I reported this. Thanks.