Related Products Guide using Views and Entity Reference

How to Create a Product Display Entity Reference and Block View of Related Products

This will guide you through creating a Related Products block for Drupal Commerce. I found this thread while looking for a solution myself. I am happy to answer any questions or suggestions for improvement.

Install the necessary modules

  1. Download, Install, and Enable the "Entity Reference" module. http://drupal.org/project/entityreference
  2. Download, Install, and Enable the "Views PHP" module. http://drupal.org/project/views_php

Creating the Reference Field

  1. Create your product types and product display content types. For this example, the product display content types is labeled "Product Display".
  2. Navigate to Structure -> Content Types -> Product Display -> Manage fields
  3. Add a new Entity Reference field. For this example, the field is labeled "Related Products", and named "pd_related_products". The widget type is Autocomplete.
  4. Choose the number of values. For this example, this is set to "Unlimited".
  5. Select the "Target type" of "Node".
  6. Select the target bundles. For this example, there is only one product display. Therefore, we highlight "Product Display".
Subscribe with RSS Subscribe to RSS - upsells