We have the following design (see image attached), for a searchable map.
Each Practioner (user) has a custom post type with multiple addresses and information in a Repeatable Fields Group (inside the group we have the Address Field), and we would create Map View with search filters that allow showing the results as the pdf attached.
Is that possible with Repeatable Fields Group inside a CPT?
Hello. Thank you for contacting the Toolset support.
The thing is that searching posts by fields that belong to repeatable field groups is not currently supported.
For instance:
- if you have a "Student" post type and Student post type holds custom fields (Status,Rank) and you created a repeatable field group "Personal Information" with fields (phone number, email address, location etc..).
- You create a view and set this view to query post type "Student" then you cannot include filters for location field (which eventually belongs to repeating field group). When you set your view to query post type "Student", you can only add search fields that is belongs to that post type, in this case (Status,Rank).
First I will require to know what content you want to search and what fields you want to display as result. If you can share admin access details and share all your required information for search and search result fields, once I will review that information and your current setup I will be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Would it make more sense to create a "Practitioner" CPT and an "Addresses" CPT and link them via relationships? Would the search and map work with a setup like that?
==>
It could but again, when you set your view with custom search you will have to set your view to query post type either "Practitioner" CPT or "Addresses" CPT.
Having said that for instance "Practitioner" CPT have two custom fields and "Addresses" CPT have five custom fields.
- If you set your view to query "Practitioner" CPT then you can add those two associated custom fields as frontend filters
- If you set your view to query "Addresses" CPT then you can add those five associated custom fields as frontend filters
Its not possible that you set your view to query "Addresses" CPT and add custom fields belongs to "Practitioner" as frontend filters.
I suggest you test this with the test site. Following is a test site I've created, you can login in using the following link:
- hidden link
You can see how the custom search with map is created:
- hidden link
Or you can create your own post types and fields and try to create new page and see how it works.
1. We have the map working now, but we would like to when a result (city or postal code) is not found on the map to show the nearest result instead of on the map. Is that possible?
2. Is it possible to have a link to the pin on the map?? so if I click on "View Location", the page will scroll to the pin on the map.
1. We have the map working now, but we would like to when a result (city or postal code) is not found on the map to show the nearest result instead of on the map. Is that possible?
==>
Yes, its possible.
2. Is it possible to have a link to the pin on the map?? so if I click on "View Location", the page will scroll to the pin on the map.
==>
if you mean that when you click on the link it should open related marker on map, then yes, its possible.
But first I would like to know where you created your map? Can you please share URL of that and admin access details.
I have set the next reply to private which means only you and I have access to it.
Now, when you click on the "View Location" link it will open the related marker on map. The above link is added using the "Focus on marker" button that is available with you click on "Fields and Views" button. Please check the following screenshot:
- hidden link
but for #1 what I meant is if someone search for a City and/or Postal Code and a result is not found, I would like to show the nearest City with the result on the map. does that make sense?
In the case of my two screenshots in reply #2320039: the postal code search brings up no results, but there is a location across the street (postal codes are only a few streets in size).
So rather than the postal code "search" searching, can we make it just centre the map?