I have a content type called 'Product Feeds' that contains hundreds of nodes. These product feed nodes have fields attached; product name, product description, product price and also a taxonomy term field for the shop name.

I want a view that shows me all the terms from 'shop name' vocabulary along the top of a table then all the other attributes in rows so I have a comparison of prices, descriptions etc.

Can anyone offer any pointers in how to do this?

enter image description here

1 Answer 1


The way I would implement this in Views is to create a node (of type 'Products Feeds') for each product the way you suggest. Then I would add an additional field (field_unique_product_code) and make that field a taxonomy term (term reference) of a vocabulary named 'products'. That vocabulary would contain unique products codes for all the products your system will process. The shops need to use the same unique product code (or you need to translate shop-specific SKUs in the incoming products feeds to this unique product before saving the node). Note that while the product codes may be strings (e.g. sony-kdl-46R473a, each term gets an unique numeric id in the vocabulary (for instance, the term for this particular Sony tv model may have the numeric id '42'. Take a note of this number, because you're going to need it later.

Now, perform the following steps:

  • Create and save a new View named 'Comparisons' and make it a view of type 'Products Feeds'. Press 'Save & exit' to save and exit.

  • Go back and edit the View:

    1. Make the format for the View 'Grid'.

    2. Click on Show: Content, and change the radio button from 'Content' to 'Fields'.

    3. Add the fields you want to display (shop name, price, description), rearrange the sequence and remove the display of labels.

If you look at the auto preview (bottom of page) at this point, you'll see that you have a nice grid display of the shop name, price and description, but for all the products, rather than for a single product.

To narrow down the display for a single product, you need to add a contextual filter.

  • Expand the Advanced section (to the right in the Views UI), click on 'Add' next to Contextual Filters, and add the field_unique_product_code as a contextual filter.

Now, look up the numeric ids for your unique product codes. Let's say your database contains a product with product id 42. Type in '42' in the textfield with label 'Preview with contextual filters', and click 'Update preview'.

Now, the preview should be restricted to a comparison between the shops, restricted to a single product. Click 'Save' (top right) to save the View.

Now, you can produce comparions of specific products just by including their numeric product ids in the URL. For instance:


will produce the comparison grid for the product with numeric product id 42.

This should give you the basic functionality you're looking for. A lot of refinement is possible. For instance, if you want to use products names in the URL for contextual filtering, you need to create URL aliases for the numeric ids (you do this with Administration » Configuration » Search and metadata » URL aliases).

For more refinement, you can use templates to get a nicer layout of the table grid, and add a left column with labels.

(But if you need help with these refinements, ask separate questions after you've got the basic grid with the contextual filter working.)

  • Hi Gisle, thank you very much indeed. I will set about implementing this method and let you know how I get on. I also just tested out the Views Flipped Table module again and that seems to be one possible solution although needs more investigation. Kind Regards. Nov 3, 2013 at 8:52
  • I have got this working with the grids - thank you. I then used Drupal 'Flipped Table' view to play around with the results in tables. However I cannot get a view of all the shops across the top, all the products down the left hand side with the prices in the middle - like a price matrix in an Excel sheet. Wondered if anyone had any pointers on this? Thanks in advance for any help. Nov 27, 2013 at 16:11

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.