Forums › Forums › Search & Filter Pro › Sub-taxonomy field
- This topic has 7 replies, 2 voices, and was last updated 3 years, 10 months ago by Trevor.
-
Anonymous(Private) January 4, 2021 at 10:46 pm #271631
It is possible to create or use a field that renders the sub-element of an taxonomy?
For example:
I have a parent taxonomy elements called “Ford” and “Toyota”
And I have a sub-elements called “Fiesta” and “Mustang” under “Ford” and “FJ40” and “Camry” under “Toyota”
How can I make that when I select “Ford” only “Fiesta” and “Mustang” appears? This having in count that 1 product can have all those taxonomy elements attached. What I’m looking for is that the taxonomy hierarchy be respected in the second field.
Trevor(Private) January 5, 2021 at 11:07 am #271656You would need two separate taxonomies:
Make
ModelThis video may help (made for a different user):
https://www.screencast.com/t/j8IUFm20
That Hipster term seemed to have 12 posts, but in fact had none! Something wrong with my posts (too much of me playing on a development site).
I apologize for the sound and presentational quality. It was early in my morning, so I was not fully awake!
Anonymous(Private) January 5, 2021 at 12:53 pm #271682Yes I tried that but there is no possible way to link “Ford” to “Fiesta” and “Mustang” and “Toyota” to “FJ40” and “Camry” if I use two different taxonomies for Make and Model.
Remember that all these 6 taxonomy elements applies to the same product/post but in order for the filter to be accurate it needs to differentiate between the models that are part of “Ford” and the models that are part of “Toyota”. That’s why I think having hierarchically organized is the same taxonomy is the way to go but still don’t know how to make the filter to respect that hierarchy in two separate fields.
Trevor(Private) January 5, 2021 at 12:55 pm #271684Our plugin will link them for you (based on how you use them in posts).
To do this, in the General Setting tab, set
Auto Count
(both settings) toON
And then in the Form UI:
In each field set
Hide Empty
set toON
In your case, if you select Ford, only Fiesta would then show. If first you selected Fiesta, then only Ford would show.
Anonymous(Private) January 5, 2021 at 1:17 pm #271692The posts are spare parts that applies to multiple car makers, car models and years. I first identify this problem with years (a spare part that applies for different models of cars but different years of that models) but also applies if a spare part works for different models of different brands (less common) so the solution should work for both cases.
The last solution I thought was to put the years under the models in a hierarchy, make two fields of the same taxonomy and hide the child elements in one field and the parent elements in the other. If the filter respected the hierarchy of the taxonomy after I select a model in the first field this have worked fine but that’s not the case.
Trevor(Private) January 5, 2021 at 2:09 pm #271694Ah
I think the data structure may be the issue.
How would your user expect to be able to search?
What is it that they are trying to find? For example, do they have a car and want to find what you have for that car? That is what happens when I search for a part for my car. You first identify the car (which can be tricky) and then identify the type of part and it gives you the parts, from which you select. It can be a highly complex search, and one that is not best suited to WordPress taxonomies and post types.
Spare parts web sites have huge inventory ranges. In essence, the way they tend to work is that each specific car has an ID number (Post Type ID in WordPress), which is attached to the part. Each part can have multiple IDs attached. The search is then two fold. First the user narrows down the choice of car, which yields the car ID, and then that is used to fetch available matching parts. This, it is two searches joined together.
If that sounds like what you are trying to do, this isn’t possible with our plugin, and I do not know of any WordPress plugin that can do this (I have a background in cars and car parts). Most sites that do this type of search are custom built, using a relational database (which WordPress does not) and a third party database of cars (for the car IDs).
The best that you could achieve would be to do as you did, with a single taxonomy and a hierarchical structure, but you could then only have one field based on that taxonomy, with the limitations that brings.
-
AuthorPosts