4
Answers
Vote up!
0
Vote down!

Product categories with hierarchical taxonomy

I'm trying to create a catalog of my products.
I have only one vocabulary which has hierarchical taxonomy.

For example:
Tiles
-- Wall tiles
-- Floor tiles
Bathroom
-- Bath tubes
-- Taps

My products could be in one main category but in several sub-categories.

This hierarchical taxonomy simplifies the entry of new product. There is no need to enter a collection field and several product categories.
And with the help of taxonomy menu (and nice menu), my main menu could contain all my product categories as a dropdown menu and not only The collection level.

On the page of any level term:
1. I should display all products of this category but also from sub-category(es)
2. My products should be grouped by sub-categories

How I made my views
(without Search API because doesn't handle taxonomy depth as far I know) :

Path: taxonomy/term/%

Contextual filter: Content: Has taxonomy term ID (with depth)
Depth: 1 (in my case I have only 2 levels, increase if you have more than that)

Fields:

  • Content: Rendered Node
  • Content: Product category
  • Multiple field settings
    Display all values in the same row -> Unchecked

Format: Grid
Grouping field: Content: Product category

It works great when i"m seeing a main level category for example Tiles
But goes wrong when I'm on a sub level.

If I have a tile which is under Floor and Wall, when I will see the "Floor tiles" page for example, both sub-categories "Floor tiles" and "Wall tiles" will be displayed instead of only "Floor tiles" because the grouping field is my node terms and not the one of my contextual filter.

Is there any other way to do that ?

Asked by: heyyo
on March 12, 2013

4 Answers

Vote up!
1
Vote down!

I finally came to a solution for my problem.

By using panels. I have 2 variant for each term depth.
Each variant will load 2 different views.

This rules selection is not available by default i panels, a new module has been proposed on this thread:
http://drupal.org/node/1446626

It works great, but I would have preferred not to use panels for this. If you have any other solution let me know...

Answer by: heyyo
Posted: Mar 14, 2013

Comments

Can you please post an example? I tried to do what you say but without results!
Thanks!

- smurf on February 11, 2014
Vote up!
0
Vote down!

Had the same problem. Here's a solution I came up without using panels: create a taxonomy term view that show terms with a given parent. This view has the parent term as a contextual filter.

Then use Views Field View to embed a view of products as a field. That view has the product category as a contextual filter.

https://drupal.org/project/views_field_view

Answer by: drifter
Posted: Jun 14, 2013
Vote up!
0
Vote down!

A solution without using panels: create a taxonomy term view, with a contextual filter for parent category.

Then, use Views Field View to embed a second view of product display nodes for every term:

https://drupal.org/project/views_field_view

Answer by: drifter
Posted: Jun 14, 2013
Vote up!
0
Vote down!

Can you please post an example? because I tried to use views module view but without success :(

Answer by: smurf
Posted: Feb 13, 2014