0

I'm working on a videogame website. I use Drupal Commerce with Druapl 8 to manage games.

For example : (Sonic the Hedgehog) is the Product, and (Mega Drive - EUR) and (Mega Drive - JPN) are the variations. Users can create different types of contents (reviews, cheat codes, etc) for each game. Each content type has a field [Product] and a field [Product Variation].

The product page URL is /game/product_title-product_id (e.g /games/Sonic-12)

On each product page, I have several blocks, and each of theses blocks is a view with a list of content with a contextual filter related to the product ID displayed in the URL. For example, here is the view for the cheat codes block :

Cheat codes blocks view with contextual filter

Thanks to the "Prepopulate" module, when a user clicks on the link to create a content on the Product page, the [Product] field is already filled.

What I'm looking for is a way, on the content creation page, to show only the Product Variations related to the Product page I'm looking at.

I've created an entity reference with a contextual filter that displays the variations of a product when I enter the product ID. It works fine in Views, but I don't know how to use it to select my variations when I create my content.

Entity reference to display Product Variations from Product ID

tl,dr : when I click on a link on my product page to create a content, I want to display a list (or checkboxes) with only the variations of this product.

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.