Skip Navigation

[Resolved] Retrieve part of the address

This support ticket is created 7 years, 7 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.

Our next available supporter will start replying to tickets in about 2.09 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Beda 7 years, 6 months ago.

Assisted by: Beda.

Author
Posts
#505810

Pat

Hello,

I have created an address field and would like to know if it is possible to extract the zip code in order to display it in a Views.
For example, I have this address in my address field : 15, bd de Vaugirard 75015 Paris

and wants to display : 75015

I have seen this ticket (https://toolset.com/forums/topic/search-zip-code-from-address-field/) but this is only valid for a parametric search and not for displaying the zip code only.

Regards
Pat

#505870

I see this request every then and when, and I decided to create a Feature Request for this, even though I do not see an easy way to achieve it, but it's a often requested thing, and I see the potential in it.

What you try to achieve is not possible with the Address Field, as that is one single value, not separated by it's components.
Of course there are custom solutions, but I cannot go into detail in this forum about them, as it is custom programming work.
https://toolset.com/toolset-support-policy/

I've seen Users of Toolset, they created a Custom Code that stripped the string, so they where able to get out only Nnumeric Data at a given position, which then matches the ZIP.

But as said, it's not natively possible with Toolset.

What you can do is create a Custom Field where the User has to enter the ZIP, or you somehow update that during the post creation process.

I will ask the Developers to think about this feature, but as said, I cannot promise much in this case.

#505879

Pat

Hi Beda,
Thanks for your return.

I can understand the Toolset policy of course.
I'm OK to place it in the todo list for developers
Concerning your potential solution to create a specific field, this is possible but not acceptable in terms of friendlyness as the user has to write 2 times the same think.

The other way is to create 3 different fields for address :
- street name and number
- zip code
- city

With that, you are able to filter by what you need (zip or city ...) and you can combine them in order to built a complete address field to cope with Toolset map.
The bad news is that you loose the ability to validate in real time the address when the user is creating it thanks to the Cred form.

So, no solution is able to fulfill 100% of the needs and a new development would be appreciated !
Regards
Pat

#505880

Pat

Hi Beda,

Sound good. I will test your function.

I agree that this should be a standard Toolset function in the end (as it is already developed !!!).
Regards
Pat

#514869

Hello, this is me again.

After careful review, we decided that this will not be implemented.

It's impossible since addresses are not in the same format in all countries.
We can not have a simple, unique way of extracting any address piece after getting the address string.
Google sends us back those pieces when we geolocate an address, but we discard them, and we had a support ticket where we discussed this with a WebDeveloper as well: we can not cache all the address pieces or the size of the maps cache would triple itself.
Also, this is not possible fo backwards compatibility reasons too.
If you need a specific piece of an address, you would need to use a specific field for it.

Thank you for understanding.