0

I want to display a list of other products from the currently-viewed product's taxonomy/taxonomies on the product page. It would ideally be a text-only list, and would be limited to five or ten products. I'd rather not go the route of node/entity reference fields, as I have hundreds of products. Yes, it would be more accurate to do it that way, but displaying products based on their taxonomy would be accurate enough for my purposes.

Can anyone tell me how to set up something like this? Perhaps with Views?

Thanks!

2 Answers 2

1

After a bit more digging, I came across a wonderful solution: http://scito.ch/content/show-related-nodes-block-based-taxonomy-terms-views-3-and-drupal-7

  1. Create view (block)
  2. Add fields (title, a small image, date, whatever you like). Or teasers, what works as well.
  3. “Arguments” is from now on called “Contextual filters”, so go there.
  4. Add the filters: “Content: Has taxonomy term ID (with depth)” and “Content: Has taxonomy term ID depth modifier”
  5. Configuration on this filter: → When the filter value is NOT in the URL: → Provide default value → Type: Taxonomy Term ID from URL → under that, check the box “Load default filter from node page, that’s good for related taxonomy blocks.” → now check the boxes of the taxonomies you want involved here
  6. Now you need to add the second filter in order to exclude the current node from the list. Click [+] button of the contextual filters section.
  7. Select Content: Nid
  8. Set the ‘when argument is not present’ to ‘Provide default argument’
  9. Set the ‘Default argument type’ to ‘Content ID from URL’
  10. Go to “MORE” , and check the “Exclude” box.
  11. Move the filter “Content: Nid” to the top position.
  12. Add a block to your view and embed the block on your node pages
  13. Save your view
1
  • I just realized that this solution only takes into account a single taxonomy from the currently-viewed product. If a product is tagged in multiple taxonomies, the Views block only shows products from the top-most taxonomy of the currently-viewed product. Does anything stand out in those instructions about that could be tweaked to show products from all related taxonomies?
    – hockey2112
    Commented Jul 25, 2013 at 18:06
0

I think Views will work good for the task.

The setup could be: Content type - product content type - field for taxonomy term information /single, multiple, etc./

Views - filtering content /not taxonomies/ - contextual filter by taxonomy term of node id from url - there is a checkbox to take information from the node, useful option - add the filter one more time, select current node id from url, and exclude, this would exclude the currently viewed product from the list of relevant products

I think this would be good enough, but if not, check this comparison https://drupal.org/node/323329 for ready to use solutions

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.