I am working on an e-commerce website development. I have the conventional Products -> Product Variants which goes through Order and payment gateway workflow. However, there is something different in this conventional scenario.

I have setup Product -> Product Variation to categorise the different type of fabrics which fall under a same style.

We have different kinds of fabric which we source from vendors in lots. It so happens that we do not get the same colour, pattern every time and so our Product and Product Variant will be obsolete once we have exhausted the stock.

For this reason, I have setup Taxonomy as per the product classification in our case and I am tagging each product variant with appropriate taxonomy.

This is my Taxonomy hierarchy for example:

enter image description here

And I have made provision to tag this Taxonomy to my Product Variant and this is how it looks:

enter image description here

Now, I would want the user to leave a rating and review for the Product variant after he/she places an order with us. I have added FiveStar rating module and jEditable modules (this is used to edit the field by user in display mode) so that user will be able to Rate and add a Review in "Order Item" as I want the user to be able to rate and review each line item which he/she buys from us. This is how it looks:

enter image description here

It's all fine until now. But now I want to create a Block which will be placed below the product variant selected by user and it should do the following:

  1. Place a block below in the Product Variation Page.
  2. Fetch all Order Items (within Orders) placed by all users for the same taxonomy which is being shown in the Product Variant Page.
  3. Display the User Name, User profile picture, rating and review left by the user from the above fetched order item which contains the same taxonomy information.

enter image description here

I seem to be completely lost in this last step of fetching ratings & reviews by users on previously placed orders on the same taxonomy as the product variation which is being viewed by the user currently. I have tried to see if there is a module which I am trying to achieve but could not find any. Also tried to see how I can build blocks to achieve this but I seem to be lost. Do I need to do some custom coding to achieve this or is it possible to fetch this relationship somehow? Am I missing something?


1 Answer 1


This is what I would try:

Create product block view, add 5 star rating field.

Under advanced (located in the far right).

Add relationship of tax term field.

Add relationship of user.

Add contextual filter of term ID (select provide default value, tax term id from url)

Add contextual filter of user ID (select provide default value, user ID from logged in user).

Place view block, and check a product page.

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.