Skip Navigation

[Resolved] Custom Fields: Hirachical Dropdown List

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

Author
Posts
#1887953

Hello,

I'd like to setup a small classifieds website. In order for the user to make as little errors as possible I'd like to have pre-defined values in a dropdown list depending on the previously selected item.

For example: We specialize on electric scooters and dealers can sell these. So if the dealer chooses to select a BMW, the next dropdown field should only show 3-series, 5-series, etc, but not C-Class, E-Class or S-Class. And so on.

Make (e.g BMW, Mercedes)
--> Model (3-series, S-Class)
----> Line (Sport-Line, Exclusive Line, Avantagard)
----> Color
----> Motor

But I specifically don't want to use hierachical taxonomies because again there's too much room for error when selecting the right taxonomie when adding a new vehicle.

Thank you very much

Benjamin

#1888063

Hello Benjamin and thank you for contacting the Toolset support.

I believe that you will need to have pages with search filters, right? For that, I believe that using hierarchical taxonomies would be the most efficient solution. From a performance perspective.

But, I believe, you can get what you want with multiple custom fields and conditional display.
For example:
- A taxonomy or custom field for "Make".
- Multiple taxonomies or custom fields for each Make's Models.
- Multiple taxonomies or custom fields for each Model's Lines.
Does it make sense?
But, this will be hard to manage later, especially, in views or archives where you want to implement search filters. But, you can overcome this, by using a custom code that will sync the values of all these fields into one or multiple "general" hierarchical taxonomies, which will be used then for views and archives filters.

Another solution, if you are letting users submit posts from a Toolset form, would be to hard-code all the possible values in the form, then use a custom code to save the values in the taxonomies. Does it make sense?

Another solution would be to use hierarchical custom post types, but pages with search and filters will not be as fast as when using taxonomies. With this solution, you can include filters for parents and ancestors.
- Custom post types "Make", "Models", "Lines".
- One-o-many relationships "Make<>Models" and "Models<>Lines".
The real estate example uses this technique https://toolset.com/course/wordpress-real-estate-sites/

I hope this helps. Let me know what do you think about it and if you have any questions.

#1889359

Than you for your detailed reply!

I chose your first solution. I wasn't aware of the conditional display feature. This makes the most sense to me, but I wished there was a more user friendly way of displaying the conditions, like some sort of hierarchical view. But it's good for now.

So after creating a custom field it is important to save. Only then the conditional display feature will activate and one can chose the conditions to show this particular field. Awesome!