related products

Related products block

This related product how to is for Drupal 7 and Ubercart 3. This will let you show related products on the product node page. The products to be shown can be selected by the store admin and can contain any mount of fields from just a Node Title to Full product with buy button.

You can view a demo here http://www.ubercartdemo.com/node/1 Look for the Related Products block on the right bar below the cart block.

  • Download http://drupal.org/project/references and install References and Node References modules
  • Go to admin/structure/types/manage/product/fields and add in a new field called Node Reference and call it say Related Products.
  • Choose Select List for the widget type (or what ever widget you'd prefer).
  • Where is says "Content types that can be referenced" select the UC content types. In a stock install it would be called Product. Save the field to be taken to the next page.
  • Scroll down to the bottom where is says Number of values and choose "Unlimited" for Maximum number of values users can enter for this field.

That should be it for the References module setup.

Now to create a view.

  • At /admin/structure/views click Add new view.
  • Give it a name
  • Choose Show "content type" of type "Product"
Read more

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".
Read more
Subscribe with RSS Syndicate content