How to best display Commerce Products to fetch and filter selectively Content, Commerce Products, and Taxonomy Term rendered entities and fields in Drupal 7

In Drupal 7, the challenge in display custom views when working with Drupal Commerce is that the Commerce fields by default are programatically separated and distinct from content fields and entities of your usual Drupal content types - including for instance the Product Display content type. In this example, we have a Content Type > Product Display, with referenced Commerce Product fields. Needless to say each has its own set of fields, normally the Commerce fields are rendered inside your Product Display, as the common and preferred setup for D7.

Example scenario / setup of contents and products:

  • Product Display fields - a generic "outer container" of information with fields such as: Product Title, general Category, Brand, Body / Description, etc.
  • Product (Commerce) fields (referenced inside the above) - this is an "inner / referenced / embedded" set of information within the above Content Type "Product Display"; this probably has the default and custom, additional Commerce fields such as: SKU, Price, Images, Color, and other attributes

Issue / Challenge
Drupal basic and even intermediate users of Views will mostly find it challenging to establish a relationship or context between "Content" and "Commerce" in working with Views output and display. This is due to the distinct and separate entities of your Content and Commerce

Simple, easy yet effective setup 

  1. Download, install and enable "Commerce Views Display" This will provide you by default a set of Commerce templates when creating your views
  2. Add and select a new View using under "Show" the desired Commerce setup - for example: Commerce Product (you may use as necessary other Commerce options); continue to edit your new View
  3. Relationship - before proceeding any further below, we need to tell our Views that we need to output both content type and products and its relationships in between for whatever purposes such as displayin fields of both. For this,  under Advanced (right side of your Views edit mode), click Relationships, search for and add Commerce Product: Referencing Content
  4. Format - use as needed or required; under Format settings, check on "Force using fields" - this is optional, but is sometimes a good option if you are comfortable with working with and would want complete control of your display of fields; under "Show" use whatever is desired - Fields or Rendered entity; again, you may use fields for complete control
  5. Fields - by then, at this section you are now able to selectively use and control appropriate fields the usual Views manner
  6. Filter - setup according to your needs the normal Views manner
  7. Sort - setup according to your needs the normal Views manner
  8. Other Settings - proceed with other usual Views settings and configurations as needed - block name, menu for page, aggregate, query settings, expose filters, etc.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.