Hi,

I would like to create a hierarchy, built as a product catalog, but without any eCommerce elements.

The catalog should be structured in a hierarchy, with level 1 being the main categories, and with more categories as their children (sub categories), with the products as the end branch of this so called tree.

Also, I would want my urls to match the hierarchy.

For example:

(category) http://example.com/category/fruit/
(category) http://example.com/category/fruit/apples/
(product) http://example.com/category/fruit/apples/red-apples
(category) http://example.com/category/vegetables/
(category) http://example.com/category/vegetables/tomato/
(product) http://example.com/category/vegetables/tomato/cherrie

When a user goes to http://example.com/category/fruit/ for example, I would want them to see a listing of the subcategories (apples, oranges, etc) but not the products of these subcategories (I don't want them to see "red apples" for example).

It sounds very simple and basic, but I have not been able to find any information on how to accomplish it.

Thanks so much for all your help.

Comments

tvn’s picture

You could build a hierarchy of categories with Taxonomy and then output it using Views.

drupalmeister’s picture

I actually tried using Views, but what I get when browsing to the following:

(category) http://example.com/category/fruit/

I get a listing of all nodes that were attached to the taxonomy terms which are children of 'fruit', thus I get all children of 'red apples', while what I want is to get just a listing of the direct children of 'fruit', being just the taxonomy terms 'red apples' and 'green apples' but not a grandchild of 'fruit' (that is, a child of 'red apples').

I hope it's clear enough...

In other words, I need that browsing to a taxonomy term will give me just the direct children of the taxonomy. 'fruit' should list 'red apples' and 'green apples. Only when the user clicks on 'red apples' will he get a listing of all types of red apples, which are attached to the 'red apples' term.

As I'm thinking about it, I see that what I want is basically two views.
The first view should give me a listing of the current taxonomy's child terms. That is the view that will bear 'red apples' and 'green apples' as a listing of the taxonomy terms which are children terms of the current taxonomy 'fruit'.

And the second view will give me a listing of nodes which are tagged with the current taxonomy, so all nodes which are tagged as 'red apples' will be listed.

What should happen is that I should be seeing a different view depending on the page. For example, when I go to http://example.com/category/fruit/ it would give me the 'taxonomy children' view (green and red apples), but when I will than click on 'red apples' I would get a view which would list all nodes which are tagged with 'red apples'.

I was not able to achieve this so far using Views, but perhaps that is just because of my lack of Views knowledge as I'm sort of a beginner...

I would very appreciate some pointers to lead me in creating this catalog structure using Drupal.

Thanks a million to all.

I hope I cleared it up enough.