1

I've created a Taxonomy Vocabulary with the name "Remarque prix". I imported it as a Term reference field to Commerce Product with the aim to be able to give a unique Vocabulary term to each product (SKU).

I want to present the Vocabulary term description in the the node by using Views so I created a View showing the Term description and took it into the node as a dynamic field, but I can't figure out how to set Contextual filters and maybe Relationships within views so each SKU/Product will have the correct Vocabulary term.

I have spent over a full day on this but can't figure out how to do. Could maybe anyone help me, please?

All the Best

Hans

0
  1. Create a block view of Taxonomy terms from your desired vocabulary.
  2. Add a Contextual Filter (Taxonomy term: Term ID)
  3. Check "Provide Default Value"
  4. Select "Taxonomy term ID from URL" from the dropdown.
  5. Check "Load default filter from node page, that's good for related taxonomy blocks"
  6. Check "Limit terms by vocabulary"
  7. Select your vocabulary ("Remarque prix" if I understood your question properly).
  8. Add the Taxonomy Term name and description fields.

Now you simply add the block to your product pages (easiest is just using Drupal's blocks, but you may have a different way you want to handle this.

Appendix

It doesn't matter if your taxonomy term ID is visible in the URL or not, Drupal understands and will acquire it.

Note: If I understand you context accurately, it seems as if your content type for Product has a 1:1 ratio with your SKU vocabulary. At this point, I would consider whether it's actually necessary to have that vocabulary. Generally vocabularies are best used to group content similar in some ways (i.e. the same taxonomy term is used in multiple places). It might be better to make this a text field on the content type rather than a separate vocabulary. But I also don't know your exact situation, you may have good reason for doing it that way. Just some food for though.

  • I've found the solution and have posted it on drupal.org. In short the problem was solved with edit your View > "Advanced" > "Query settings" : check "Disable Query Rewritting" drupal.org/node/2723357 For a full explaination pls see drupal.org/node/1276450 and #151 Thanks Hans – hassebasse Jul 15 '16 at 16:00

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.