Hi, I am building a directory listing website (car service).
To help users find car service shops in the nearby area, I want to create search filters that go like this:
States > Counties > Townships > Municipalities
The way I want it to setup is:
if State A is selected, only Counties in that state will be displayed in the County dropdown field
if County A is selected, only Townships in that county will be displayed in the Township dropdown field
etc
The way this is facilitated in Toolset is by creating custom post types for each level (e.g. for states, for counties, etc.) and then connecting each of these in one-to-many relationships (many counties belong to one state).
You then connect your listing posts to the municipality posts in another relationship, and when you add a listing to a municipality it is then implicitly connected to the other location types.
You can then insert a relationship filter into your search View and the ancestors can be included to give the workflow you describe, whereby users first select a state, then a county, then a township, then a municipality.
Hi, I have successfully connected the said custom post types.
However, i am still lost as to how to create a relationship filter into the search View.
Can you point me to some video tutorials/documentations on how to do this?
I did my due diligence but couldn't find one that matches the setting I want to achieve.
I actually watched the https://toolset.com/course-lesson/creating-a-custom-search/ video earlier but the video does not have the information I am looking for.
As mentioned in my earlier messages: I want to create search filters (dropdown) where user can select:
- states
- counties
- etc
to find the nearest car services shops.
What I cannot figure out after watching the video is how I can create those filters in such a way that when State A is selected, only counties in the that state get shown in the counties search filter?
The problem is, I can only use it one. So, if I use it for State for instance, I can no longer use it for County, etc.
Where did I go wrong?
PS - I did create state, county, etc as custom post types as instructed. However, I did not create custom fields for each of the custom post type since I thought that the only information that's need for each post type is the type of post which is the name of each state, county, etc. Should I actually create custom fields even though it is for the name of the state, county, etc?
Hi, I just wanted to let you know that I figured out where I went wrong.
Problem's solved now.
Thanks so much for your help and patience. I truly appreciate it.