Support Center

How to create a Related Nodes block based on taxonomy terms with Views in Drupal

Last Updated: Oct 22, 2013 10:59PM EEST
You can find below all the appropriate instructions on how to create a Related Nodes block with Views in Drupal.

All screens come from our Premium Responsive Drupal theme Best Brand. Best Brand is a complete Drupal distribution including several modules, content types, view pages, view blocks, pre-configured image styles as well as a premium theme tailored together to achieve its functionality. It comes with an installation profile that allows you to have a fully-functional site up and running in few minutes.

Best Brand comes with the build in Product content type. Product content type comes with several fields - one of them is the Product Categories field (field_product_category). 



Best Brand presents a Related Products (OTHER PRODUCTS IN CATEGORY) block alongside the product your visitor's looking at. Which, needless to say, is exactly what a product listing theme should do. Creating a block of links for related products is a useful way to keep visitors engaged in the selected Product Category to have them to continue reading.



The following block will work for you even if the maximum number of values users can enter for this field is 1 or unlimited. 




 

How to create this Related Posts block with Views

1. Add/Create a new View block through Home » Administration » Structure » Views
2. Add the Content: Fields you need under FIELDS and filter your results to a specific content type under FILTER CRITERIA - Content: Type (= Product)



3. Add the Contextual Filter: Content: Has taxonomy term ID (with depth) and Apply this filter after the following configuration:
- Allow multiple values
- When the filter value is NOT available

Provide default value: Taxonomy term ID from URL
Load default filter from node page, that's good for related taxonomy blocks
Limit terms by vocabulary
Filter to items that share all terms



- When the filter value is available or a default is provided
Specify validation criteria with Validator: Basic validation



4. In order to exclude the current node, add a second Contextual Filter: Content: Nid and Apply this filter after the following configuration:
- When the filter value is NOT available
Provide default value: Content ID from URL
- Under “More”, check “Exclude”



5. Save your changes and place your block inside a Drupal region.

​In case this article leaves any of your questions or concerns unanswered, please feel welcome to email us or post a public question.

​More than (just) Themes
http://www.morethanthemes.com/

Contact Us

support-agent@morethanthemes.com
http://assets3.desk.com/
false
morethanthemes
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete