0

on a website I'm working this period i have this problem with Taxonomy term View: My scenario is like this : I've created a vocabulary with terms and sub-terms for my products categories. So for example there is a structure like this:

First Category: Computing-->Laptops (Apple, Acer, Dell)--> Desktops (CPU, RAM, Hard Drives, VGA)--> Servers (HP, Dell, Cisco, IBM)

Second Category:Peripherals--> Monitors (Samsung, LG,Dell, Asus)-->Keyboards (Logitech, Microsoft)--> Printers (Epson, HP, Samsung)

I'm using taxonomy term view to make the taxonomy term page to show the products in a grid using fields. Everything works fine, when i click for example on Dell i see XPS14, XPS14Z, XPS15 etc in a grid format with a thumbnail picture and the title below it. (I' created a field for thumbnail for every product).

What i want to do is when i click on Computing for example, to show only Laptops, Desktops and Servers with a thumbnail for each one and not all the products for Computing term ( Apple,Acer,Dell,CPU,RAM,Hard Drives...etc) as it happens now. I've tried to put some contextual filters from the view but i didn't figured out how to accomplish it yet.

  • What is the second category for? Do product belong to the first AND second category? Under Computing > Laptops there is Apple, Acer and Dell. Are these child taxonomy terms or nodes? – Felix Eve Apr 28 '14 at 14:20
  • Sorry, that i didn't make it clear. Products belongs only to one category and these are child taxonomy terms eg Term 1 Computing --> child sub term Laptops --> child sub term Apple etc. For example there is product XPS15 that is tagged with Dell. – nikos_sty Apr 28 '14 at 14:28
2

I'm assuming you are using the "Taxonomy term" view that comes with drupal.

Edit that view and:

  1. Edit the contextual filter for "Content: Has taxonomy term ID (with depth)" enter image description here
  2. Set the depth option as high as you need to cover the number of levels in your vocabulary. enter image description here
  • Thanks for the quick response, but I've already tried this and the result was not what i want. Changing the depth just reduce or increase the depth of parent terms showed, so if i change it to 2 then clicking on computing will show all the products in computing e.g all the laptops products, all the cpu products, all the rams, all the servers etc. I just whant on clicking Computing to show categories Laptops, Desktops, Servers. – nikos_sty Apr 28 '14 at 16:41
0

I think the solution here is going to be to use the pre-made taxonomy term pages to list the products, but use custom views to list categories.

If you make a new view that shows taxonomy terms from the computing vocabulary, and then add a filter so that parent term = 0 then it will list Laptops, Desktops, Servers. When these titles are clicked then they will link to the normal taxonomy term listing page.

0

So I finally find the solution.

Step 1, I added an image field for thumbnails to my taxonomy vocabulary and uploaded thumbnail image to each term.

Step 2, I created a new view showing taxonomy terms with these settings: Title: %1, Path : taxonomy/term/%, Format:Grid, Show :Fields (Taxonomy thumbnail image, Taxonomy Name), Contextual Filters: Taxonomy term: Parent term (When the filter value is NOT in the URL--> Provide default value -->Taxonomy term ID from URL and checked "Load default filter from term page ").

Step 3 I enable default taxonomy term view i made these changes : Title: %1, Path : taxonomy/term/%, Format: Grid, Show: Fields (Title, Thumbnail), Contextual Filters: Content: Has taxonomy term ID (with depth)(Depth: -1), No results behavior: Global: View area(View to insert : The view created in Step 1)).

And that's it.

(Felix thanks for the inspiration)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.