Skip Navigation

[Resolved] Split: Using hierarchical custom fields

This support ticket is created 4 years, 8 months 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: Asia/Karachi (GMT+05:00)

Author
Posts
#1589729

Thanks Nigel,

I would the plugin that was conflicting with toolset.

I have another question.:
I am trying to create a site similar to the gym site which toolset uses as an example. My site has a listing post where companies can list their dive school, the dive classes their school offers and the dive class price. How can I create hierarchical custom fields?

Therefore on my search page, the user would be able to filter the following information (items in square brackets are searchable options and items without brackets would be the use input):

[Dive School name] [ Location] [ Dive class offered] [ Dive Class Price range]
↓ ↓ ↓ ↓
BS Divers [Country] [City] [Profesional classes] or [Rec classes] [Minimum price] [Minimum price]
↓ ↓ ↓ ↓ ↓ ↓
United States NY Class III PADI $0 $2000

#1590043

Hi,

Thank you for waiting while I reviewed your question.

I understand that you're looking to include hierarchal or multi-level front-end search fields, where options of one field are changed/updated based on the selection made in another field.

This feature is supported and you can see it in action in our "Real estate" reference website:
hidden link
( please note how the "States" and "Cities" field in the search form are interconnected )

There are two limitations though:

A. These hierarchal or multi-level front-end search fields can only be added for post-relationship and can't be used for taxonomies or custom fields.
( ref: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/ )

B. In a search form, there can be only one post-relationship filter, which means that if you'll use hierarchal filtering field for "Location" ( Country -> City ), you won't be able to use it again for the "Dive class offered" ( Class level -> Class names ).

Based on these points, a workaround can be to use hierarchal filtering for "Location" fields and for the "Dive class offered" add two independent select fields instead of one. The first one will list all "Professional classes" and the other one will list all "Rec classes", but won't be linked to each other.

If this workaround can work, this is how the structure of data will look like:

1. Custom post types:
( ref: https://toolset.com/documentation/getting-started-with-toolset/structure-your-data-with-custom-post-types-fields-and-taxonomies/#create-custom-post-types-from-the-toolset-dashboard )

- Dive Schools: will hold posts for each dive school
- Countries: will hold posts for each country that will be later used in the location filter.
- Cities: will hold posts for each city that will be later used in the location filter.

2. Custom taxonomies:
( ref: https://toolset.com/documentation/user-guides/create-custom-taxonomies )

- Professional classes: will hold terms for professional class names
- Rec classes: will hold terms for rec class names

3. Custom field:
( ref: https://toolset.com/documentation/user-guides/using-custom-fields/ )

- Price: a number field that will be attached to the "Dive Schools" post type.

4. Post relationships:
( ref: https://toolset.com/documentation/post-relationships/ )

- Country -> City: A one-to-many relationship between countries and cities post types, as one country can have multiple cities.
- City -> Dive School: A one-to-many relationship between cities and dive schools post types, as one city can have multiple dive schools.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1593473

Hi Waqar,

Thank you for your detailed response. It has helped me a lot. The only thing I am still to do is display the price.

Each dive school will offer and/or " Rec Classes" and "Profesional Classes". "Rec Classes" and "Proffesionall Classes" will each have multiple subclasses with their own price.

By adding a price custom field to the dive school I am only able to add one price per school.

#1593479

My current structure is as follows:

1. Custom post types:

- Dive Course: holds posts for each dive course
- Dive Schools: holds posts for each dive school
- Countries: hold posts for each country that will be later used in the location filter.
- Cities: hold posts for each city that will be later used in the location filter.

2. Post relationships:

Dive Courses
-Dive school - Courses

Dive schools
-Dive school - Courses
-City - Dive School

Cities
-City - Dive School
-City - Country

Country
-City - Country

3. Intermediate post:

-Dive school - Courses relationship (I have add an intermediate post with the price, course dates)
(It seems to work well however I am unable to filter price and dates in my search)

3. Custom field:

- Parapgraph
-URL
-Image

#1593831

Hi,

Thanks for the update and glad that my message helped.

I've noticed that Minesh is already helping you around the pricing filter, in another thread:
https://toolset.com/forums/topic/multiple-products-prices-per-listing/#post-1593681

You're welcome to mark this ticket as resolved and for new question or ticket, feel free to start a new one.

regards,
Waqar