-1

I want to display, let's say, three additional SKUs (e.g., skuredring3 and skuredring4) similar to the one of the displayed product (e.g., skuredring).

Is this even possible?

1 Answer 1

4

Related products in Drupal Commerce can be accomplished in a variety of ways:

  1. As entity references, rendered in a related products view Using this approach, relationships are defined manually by Store/site managers (they curate/associate what specific products/skus to show as related) as they edit each product node. Then the view is setup with a contextual filter for the current node ID and a relationship to show all values assigned to the "related products" entity reference field. Refer to this "Related Products Guide using Views and Entity Reference" post that walks you through the approach.

  2. As taxonomy tags, rendered in a related products views Using this approach, relationships are defined manually by Store/site managers (they tag products with specific classifications) as they edit each product node. Then the view is setup with a contextual filter for the taxonomy terms on the current node and a relationship for terms in the specific taxonomy on that node. See this similar post, "Related Articles - A Block View Of Nodes With Common Taxonomy Terms"

  3. As a view that programmatically looks for skus of a particular pattern Using this approach, store/site managers don't have to tag products- they just need to ensure following a standard ruleset in defining skus for products. Then the site manager would setup a view of Commerce Products with a filter on the product sku field containing "skuredring" in your example. This approach locks the view into showing only those products with the sku.

2
  • Thank you, I like the answer three the most, for example 652D_PE is main item, other skus are 652D_AM, 652D_BT-BMS and 652D_GA..so you are saying I should just focus on first three numbers of SKU?
    – hentaigrl
    Dec 18, 2017 at 1:29
  • affirmative- in your view, when you set the "filter" condition on the SKU field- make sure you choose "contains" and type the similar portion of the SKU. Worth noting- the "contains" filter doesn't distinguish between text strings starting with the desired substring from those who have the substring in the middle, or at the end. Dec 18, 2017 at 1:53

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.