Skip Navigation

[Resolved] In a view template: Listing main categories with children

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 7 replies, has 2 voices.

Last updated by jasonw-2 1 year, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2607145
ToolsetSupport.jpg

I'm trying to return a list of categories with the main category on top and the children underneath it. Then the next category under that the same way.

Is there any documentation that you are following? I've been all over support here trying to figure it out for hours. I try not to put in support tickets. 🙂

Side note: I'd like to be able to use the camera brands categories under the lenses section the same way. Do lenses have to be their own post type with their own categories for me to achieve this as well?

Thanks for any help and as always, you all rock! <3

#2607369

Hi,

Thank you for contacting us and I'd be happy to assist.

To generate a hierarchal list of taxonomy items, you'll need two taxonomy views:

1. The parent taxonomy view will show only the top-level items, with the query filter to show only the terms without any 'parent'.

2. The child taxonomy view will be nested inside the loop of the parent one, with the query filter to show only the 'terms where the parent is the item from the current loop'.

Here is a general guide on how nesting of views works:
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/

If you'd like to avoid using duplicated brand taxonomy terms, you can adopt the following structure:

1. The website will have one custom post type 'Products'.

2. This post type will be attached to two custom taxonomies:

a). Brands
Example terms: Canon, Nikon, Olympus,...

b). Product Types
Example terms: Cameras, Lenses, Tripods, E-Books,...

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

regards,
Waqar

#2607587
no.items.jpg

Hey there, Waqar!

Ok, so here's what I did:

I deleted all the categories under Products.
I created the Brands and Product Types Taxonomies and populated the listings accordingly.
I attached those taxonomies to the Products CPT.
I created the Products Parent Taxonomy View and the Products Children Views.

I have tried my best for 3 hours (lol) to get it to work. I either get No items found or I get a repeating list of every brand there is all the way down the page under every product type.

Anyway you could log into it and have a look for me please?

#2607995
dupes.png

Hey there, Waqar!

Is there a way to not show / reproduce the empty children that this loop is producing?

Thanks,

Jason

#2608019

Hi Jason,

Thanks for the update and glad that you're making progress.

To suggest the next steps, I'll need to see exactly how these views are set up in the admin area. You can share temporary admin access details, in reply to this message.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2608889

Thank you for sharing the access details.

In the current setup, the parent view ( 'Products List Parent' ) cycles through all the 'Product Types' terms, and the child view ( 'Products List Children' ) cycles through all the 'Brands' terms.

Since the terms in these two taxonomies are not actually linked together, these views have no way to restrict which of them are shown.

When I suggested the structure of using two separate taxonomies, the list of terms that I had in my mind would show two separate and independent lists without any nesting or hierarchy (through 2 separate views). One for the 'Product Types' terms and the other for the 'Brand' terms.

An alternate way of showing the term options in a more connected way would be to create a view that shows the 'Reviews' posts. That view can have the checkboxes type search filters for both these taxonomies and you can add that view on a separate page.

And in the pages where you'd like to show these terms in the sidebar, you can show this view's search form only. When the user would select an option in the search form, it will redirect to the newly created page where the view's search form and the results are both available.

This search form will be useful because, when a user will select a product type or a brand, the search form will update to show only those terms which can produce some results, which will naturally narrow down to only the relevant options.

I hope this helps and let me know if any point or step is not clear.

#2609939

Hey there, Waqar!

That's a little complicated for (me) in what I'm trying to achieve. I remade it to work as intended and all is well.

Thanks again for all your help!

Jason

#2609941

My issue is resolved now. Thank you!