Skip Navigation

[Resolved] Can I use any field to create a Toolset Filter by Distance from a given address?

This thread is resolved. Here is a description of the problem and solution.

Problem

I created a Text Field and input an address there.

Can I use it to build a distance search for it in Toolset Views?

Solution

No.
Only the Toolset Address Custom Field can be used for this kind of Search.

This support ticket is created 6 years, 8 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
- - 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 3 replies, has 2 voices.

Last updated by Beda 6 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#621360

Hi,

I have setup my address with multiple fields like, city, zip, street.

I managed to display to display those fields on google maps as an adress.
For example my code to display those multiple fields on my maps is:

 [wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' address="[types field="straatnaam"][/types] - [types field="huisnummer"][/types] [types field="plaats"][/types]"]<strong>[wpv-post-link] 

Now I would like to create a distance filter for my maps based on the city or zip code.
How can I create a view with distance based on those fields, since it's using the standard address field to get data from?

#621666

This is not possible.

I am surprised that those markers even show at the correct place.

The correct Field to use for "Addresses" is the "Address" Field Type.

When you use that Field type, you can as well create a distance Search by it, using the new ShortCode for the Custom Search by Distance.

This ShortCode can be found in the Filter Editor when you click on "Add New Filter > Toolset Maps > Distance Filter".

There, you can only pass one field for the comparison, which usually is the Address Custom Field.

Here are more details about this:
https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps//#filtering-markers-by-distance

#621800

Hi Beda,

Thanks for your reply.

I read about displaying multiple field on the maps in other topics on the support forum.
So that's working great.

The problem I have with the address field is, users tend to forget some information in the address field.
For example a zipcode or housnumber, so that's why I wanted to use multiple fields.

Is there a way of inserting those custom fields as shortcode in the address field?
So the address fields combine those outputs and create a whole address?

#622552

The "wpv-control-distance" filter (which is the distance filter) does, as elaborated above, only accept one field.
This ShortCode does not allow to call more than one field.

It is not possible to pass more than the address (or any other) Field to that ShortCode.

This requires custom code, which is out of the scope of the Toolset Support because it would mean to alter the ShortCode as it is provided:
https://toolset.com/toolset-support-policy/

Eventually, the Toolset Contractors can help with this:
https://toolset.com/contractors/