Skip Navigation

[Resolved] Using the Address field to automatically populate custom fields

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 3 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#2068273

1) Tell us what you are trying to do?
Whenever I populate a Toolset address field, I would like some code to run automatically to "break up" the address into its different components like city, region, and country. I would then like those fields stored in the DB for later use. As of now, the address field would only get populated on the backend of the site.

2) Is there any documentation that you are following?
I found this post on your site: https://toolset.com/forums/topic/separating-content-from-the-address-field/#post-2067027 . Is the code in that post still valid? Or is there a better way of doing this?

3) Is there a similar example that we can see?
-

4) What is the link to your site?
hidden link

#2068569

Hello,

There isn't such kind of built-in feature within Toolset Maps plugin, according to our support policy, we don't provide custom codes support:
https://toolset.com/toolset-support-policy/
you can add a feature request for it, our developers will evaluate it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

In my opinion, you can get address value( latitude and longitude values) from custom address field
https://toolset.com/documentation/customizing-sites-using-php/functions/#address

Then pass them to Google API(Google's geocode Web Service):
hidden link

See similar thread
https://stackoverflow.com/questions/6548504/how-can-i-get-city-name-from-a-latitude-and-longitude-point#answer-53112761

Get all information you wanted, and save them into database.