I'm building my first drupal commerce with commerce-kickstart 2 on drupal7. My client asked my to add a feature that associate products and blog posts.

At first I thought the best way was to add "product-reference" to the blog-post content type, this way the non-technical user could easily select 0 to n products to the post as "suggested" or "correlated" products, but when I added the product-reference field the whole blog-post content-type became a "product display" and the template file for the view was the wrong one.

Then I though of creating a block with a query for the products but I don't want the client to have to deal with this level of complexity.

I thought about writing the logic inside the product display template file but it doesn't feel like a good practice.

I searched for modules but I didn't find what I was looking for (maybe because I'm noobie to drupal I don't know yet how the search efficiently)

Are there any modules that can help with this?


  • Thx for the down-vote :) but can I know why?
    – barvaz
    Commented Oct 7, 2014 at 7:58
  • 2
    Please read tooltip of downvote. Here it is if you can't find it: "This question does not show any research effort; it is unclear or not useful". For me, all three apply.
    – Mołot
    Commented Oct 7, 2014 at 8:07
  • Edited my question. Hope it is more complaint. I would really appreciate feedback
    – barvaz
    Commented Oct 7, 2014 at 8:57
  • Un-downvoted, but still: Requests for tutorials and other online resources are not allowed here.
    – Mołot
    Commented Oct 7, 2014 at 9:16

1 Answer 1


So this is an important question for Drupal Commerce: What is the best practice way of creating a related products block per content type?

Fortunately, there's a simple answer. Just add an entity reference field that references the product displays:

Graphic representation of the following four steps.

  1. Add an entity reference field called "Related Products" on your blog content type.
  2. Configure this field to only show the product displays (not product entities).
  3. Hide this field on the "Manage Display" tab.
  4. Create a view block that targets your blog content type.

Graphic representation of the following five steps.

  1. Edit the view and add a contextual filter for "Node ID" and provide the default value to come from the URL. This will allow the block to bring in the node you are viewing if you are viewing your blog post.
  2. Add a relationship on the "Related Products" field you added to your blog content type and rename it "Related Products" and require that relationship.
  3. Add a field, it should be your product reference field for your product display. For me, it's called "Product" but it could be called something different depending on your setup. NOTE Make sure you set it up to use your new relationship.
  4. Modify the title to use your new relationship.
  5. Set the View Block to display in a sidebar or some region that is available on blog posts.

Kitten blog post showing the views block result.

And BAM! there you have it! A step-by-step to show off related projects in a block on your blog posts.

  • thank you so much!!! this is exactly what I was looking for.
    – barvaz
    Commented Oct 7, 2014 at 20:22

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.