Hi, I closed a thread too soon (here: https://toolset.com/forums/topic/creating-conditional-category-hierarchy-on-post-form/)
I actually have one more question:
I realized I didn't ask this. I have set up a post relationship custom search. Works great. However, with the recommended set-up, you must first select Categories, then select Type, then select Make, then select Model. I believe this is what was written in the previous ticket on further review.
Is there anyway to have four separate post relationship custom searches, where the user can individually select a Make without selecting a Category and Type first (for example)? I could just set-up four separate post relationship custom searches, but is there a way to disable the appearance of children in the filter? Happy to enable some custom scripting here too.
Or, would it be better to just opt for some Taxonomy and write custom code to enable this view query? I'm thinking of something similar to the WooCommerce Product Search works (https://woocommerce.com/products/woocommerce-product-search/).
Thanks!
Hello and thank you for contacting Toolset support.
Well, currently, Toolset does not allow to filter with more than ONE relationship. The only way to use multiple relationships is when they are somehow hierarchical. And that enforces the default behavior, that cannot be altered, the parent filters need to be selected in order to produce options for its child filter, and that one needs to be selected in order to produce options for its child filter, and so on.
If you need to offer the possibility to choose from different filters at the same time, you should use taxonomies instead of relationships. And as you may have understood from your previous ticket, there are some limitations there, because we do not have a way to link taxonomies between each other(in order to display for model only the options relevant for maker, etc.)
I hope this helps. Let me know if you have any questions.
Okay, this makes sense. I will need to confer with the client to make sure the UX works.
However, if we opt for the taxonomy, there are lots and lots of models to choose from. I would like to set-up a "searchable" field on the Toolset Post Form for the listing, so when someone needs to select a model from the dropdown, they don't need to infinitely scroll. Will a standard JS solution (a la this at W3 hidden link) work for Toolset's input fields? Just wanted to verify before I got into it.
Thanks!
Will a standard JS solution (...) work for Toolset's input fields?
Yes, it will. You may want to use the Select2 library which is already used by Toolset in other types of dropdowns.
- hidden link
Got it!
One last question, I see in the select2 functionality that it supports "headers" within the list (like the time zone separators in the example use-case). Is there a way to enable that inside a Toolset dropdown for taxonomy selection? Is there some way the taxonomy data needs to configured to enable this inside the dropdown?
Thanks.
Unfortunately no. We don't have any way to customize how the taxonomy filter will be rendered. A workaround would be to generate your custom dropdown using a taxonomy view in the legacy editor. You just need to give it a special CSS class, so the views' Javascript handles it.