2

I am trying to show related products in the products display for Commerce Kickstart. I tried using the method outlined in this tutorial but ran into a couple of issues:

  1. The "Target Type" in the entity reference field (the field used for the related product) does not show "Node" as an option.

  2. The SQL error mentioned in the tutorial appeared when selecting "Aggregate" in the view.

The bottom line is I couldn't get this to work of Commerce Kickstart.

Has anyone had any success in getting this to work for Kickstart, or an alternative approach?

Thanks in advance for any insight into this.

1 Answer 1

0

If you want to be able to reference nodes, your view must be taxonomy-based and utilise product categories. The category must be on the display node, not on the product and this is a good starting-point to understanding what's required. To see if this idea is relevant to your use-case, go here: http://www.bookfish.co.za/catalogue/gorongosa-joao-augusto-silva Bear in mind that I'm not using Commerce Kickstart but various Commerce modules on that site but it should work with CK.

To display my products, I added the following relationships & what I selected there to get it to work I have put in square brackets [ ]:

  1. Content: product [required]
  2. (Products referenced by field_product)Commerce Product: Referencing Content [required]
  3. (Content referencing products from field_product) Content: Taxonomy terms on node [required, select the vocabulary you want, identifier: term]
  4. (term)Taxonomy term: Content using Category [required, identifier: field_category]
  5. (field_category) Content: Category (field_category) [required, relationship: field_category, identifier: term from field_category]
  6. Content: product [required, relationship: field_category, products referenced by field_product]

for contextual filters:

  1. (field_category) Content: Nid [Relationship: field_category,

When the filter value is NOT available:

select "provide default value",

"type": Taxonomy term ID from URL

select "Load default filter from node page, that's good for related taxonomy blocks" and "Limit terms by vocabulary"

select your relevant category

"Multiple-value handling" select "Filter to items that share all terms" or whatever is relevant to your use case

under "More" select "Exclude"]

Aggregation settings: [Group results together]

  1. Content: Nid [Relationship: do not use a relationship,

When the filter value is NOT available:

select "provide default value",

"type": Content ID from URL

When the filter value IS available or a default is provided:

select "Specify validation criteria"

Validator: "Content"

Content types: select the relevant product display

Filter value format: "Node ID"]

Aggregation settings: [Group results together]

I then selected a view format of fields showing title, image, price and hidden fields of "add to cart form" and "stock" so that I could filter to relevant products that are in stock. For aggregation, I used "Group results together" and "entity ID"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.