1

I am creating a Drupal Commerce website in which I have created 4 Product Types and 4 Product Displays as following

  1. Health
  2. Eye / Sunglasses
  3. Contact Lenses
  4. Sports

To classify the products I have created several vocabularies, some vocabularies are common in all product display types and some are available in one or two product display types.

Now I want to use default Taxonomy Term view provided by the views module and add those vocabularies as exposed filter in that but in the way that if Health Taxonomy page is being viewed it must show the vocabularies as exposed filter related to Health Only and so on

1
  • For me it is not so clear what you are going to do. If you want to have different filters for different pages, simply create 4 different views corresponding to your 4 product types. Or use drupal.org/project/tvi and create different views for different vocabularies
    – milkovsky
    Commented May 19, 2015 at 20:39

2 Answers 2

0
+100

It seems to me that what you are looking for is not a view, but a search result page with facets.

If you want to use views, as @milkovsky said in comments, you will need a separate view for each product type. That way is undoubtedly the easiest approach.

However, if you want to direct your visitors to a single URL that dynamically adjusts to the kind of thing they're looking for, take a look at the Facets API module. That module effectively scans the results on a search page looking for categories and shows them in blocks, allowing you to narrow down the search.

As it says on the module page, you can use it with the Search API or Apache Solr Search modules which significantly improve upon Drupal's core search. I found the latter suitable to my needs, but they're both pretty good. Installing Solr on your server is the "fun" part...

For an example of what facets are, look no further than eBay. Just go to the home page and type something in the search box: the criteria that show up on the left hand side are facets (pictured below). They're not Drupal facets, and they vary wildly in their rendering, but the function is the same: narrow down the search.

facet example from eBay

4
  • In commerce kickstart example this functionality is implemented in all products page. Is it possible to implement these filters on each product page ?? Like in my case if I have these pages Health, Sports and Eye Wears can I implement these facets on all these pages ?? Commented May 22, 2015 at 5:56
  • I haven't used kickstart so I don't really know what they're using to do that.
    – Darvanen
    Commented May 22, 2015 at 6:54
  • Actually what I mean to ask is it possible to use these facets on multiple pages. Like on Health page can I use taxonomy as facets which are related to health content and so on. Commented May 22, 2015 at 7:16
  • You can create as many search pages as you like, and customise which facets show on each search page. You'll probably need one of the search modules I mentioned to do it though.
    – Darvanen
    Commented May 22, 2015 at 9:52
0

give the module hierarchical_select or it's simpler approach a try.

or see here how to programmatically play with the exposed filter(s): https://drupal.stackexchange.com/a/96769/3218

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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