Hello,
I have read the documentation and I am a bit experienced using toolset blocks but still I cannot figure out how to do what I want.
I have a custom post type "Products" and a custom post type "Product Families".
Product Families are related to Products with a 1-to-many relationship ( 1 Product Family have many Products)
Products also have several taxonomies (e.g. Type, Size, etc)
I am trying to build a search form that will display Product Families (parent) and their related Products (children) as a group, i.e.
- Product Family A
-- Product AA
-- Product AB
- Product Family B
-- Product CC
-- Product CD
I want to display only the results that will meet certain criteria (filters) based on Product taxonomies, e.g. select a Product Type taxonomy from a dropdown element and then display the resulting Product Families and their respective Products that belongs to that taxonomy.
If the Product Family is not related to any Product with the specific taxonomy (Product Type) selected by the user, I don't want to include it in the results.
I have attached an image that illustrates my case.
Please let me know If it is possible to do what I described using Toolset and if it is indeed, please provide a link to the appropriate documentation or a short answer.
Thanks a lot.
Hello,
In your case, you can setup a post view with search form, filter result with those filters:
1) Post type relationship between "Product Family" and "Product", it should output the select dropdown, like below:
- Choose one family
- Product Family A
- Product Family B
2) Taxonomy Type, Size, etc
And you can enable option "Show only filter options that would produce results", so filters will output only those options can have results.
See below test site:
Login URL:
hidden link
Result page:
hidden link
You can see view settings here:
hidden link
More help:
https://toolset.com/course-lesson/creating-a-custom-search/#steps-for-creating-custom-searches
Hello,
I get your example but what I am looking for is very different.
The main difference is that the product family is not listed in the results.
There isn't such kind of built-in feature to group search result by parent posts, but you can display the parent post information in the search result, for example, edit the post view:
hidden link
In view's loop, display the parent "Product Family" post information
See the result here:
hidden link