When I create a user a 'supplier' must be selected. When a user creates a product a 'supplier' must also be selected. Now I would like to show all the products with supplier = supplier logged in user. I now have a table with all my products listed, but now I need to add the filter. Is there a module for this or can this be done in another way? Because when I now want to add a filter only the product fields are shown.


Instead of listing products filtered by Supplier field. You want to build your View from Users and add a relationship to Products linked through your Supplier field -- see this thread with further documentation: https://drupal.org/node/1111722

So its something like the following from my above link:

  • Create a user view.
  • Add a contextual filter on user: uid. If no filter value is present, build a default value using the currently logged in user. (This will give you exactly one user object in your view -- the logged in user.)
  • Add a relationship, using the relevant taxonomy reference field on the user accounts. This will bring you information about the "interest" term for the logged in user.
  • Add another relationship, called "term: nodes marked with term" (or something like that). This will bring you information about all nodes marked with the interest term for the logged in user.
  • Either set the view to display node teasers, or select a number of fields to display.
  • Add a display as usual. Done!

Alternatively you could use Views Global Filter to set a filter based on the profile value most likely.


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.