In Drupal 7 commerce I ran into a problem.
I want to display the latest 3 items placed in the show_product content type, with attributes from the store. There are several entities in the store, displayed in the same node with the product reference field, all with different attributes and images. Imagine every online clothing shop will face the same problem regarding sizes and colors. So, in Views I need a relation on "Content: field_prodref - product_id" to show the attributes from the entities. The view shows all the products from the store. Is there a way to bypass this so the view shows only the show_product display node with price field and image?

1 Answer 1


I'm pretty sure you'd have worked out the *the latest 3 items placed in the show_product content type* part already:

  1. Add filters, Node: Type, Node type: show_product
  2. Add sort criteria, Node: Post date, Sort order: Descending
  3. Items to display: 3

For the attributes part, the tricky one, instead of defining a relationship in the existing view, you'd be better off creating a whole new view, which would list the attributes of product passed in as argument.

To make it all work together, you'll attach the latter view to the former one using one of Viewfield (7.x-dev), Views Field View (7.x-dev) and View reference modules.

An example, using Viewfield. To the show_product node type add a hidden View field called Attrview. Set it to "Always use default value". Set the default value to the attribute listing view. The argument is "%nid". Exclude its display from node teaser, full view etc.

In the first view, then, along with Price and Image, also add Attrview as a field. Done!

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.