1
Answers
Vote up!
0
Vote down!

How do I create a view of a product with a table of variations?

Hi,

For days and days I'm looking for a solution to create a productdisplay view where the product variations are listed in a table or a megarow table instead of the preformatted select lists.

The product display should look like this:
http://www.rmtools.lt/p/DIN_338_HSS_PRO_IRWIN_Quadropack/3

I cannot find the view which is used by Commerce Kickstart displaying this standard productdisplay so I can't modify it.

Or... do I need to create a complete new view?.
and If so, how do I fix it?

Many thanks in advance for your help and advice.

bEngel / Rotterdam Holland

Asked by: bEngel
on August 8, 2013

1 Answer

Vote up!
2
Vote down!

This is a pretty easy view to create once you know a bit about the architecture of Drupal Commerce. A quick lesson: You have product variations and product displays. In order to view a table of products on your product detail page, you will need to do two things.

If you are more interested in a quick step-by-step then I've outlined what I did below:

STEP BY STEP

1) Turn off the add-to-cart form on the Product Display by going here: admin/structure/types and clicking "Manage display" next to the product display you want to change

2) Create a view block of Product Displays (not Product Entities) (admin/structure/views/add) that takes the node id as a contextual argument and references the product. Note in the video I added the SKU, Product Title, Price, and Add to Cart form. Also note that the Add to cart form should be linking back to "this" page.

3) Go to the Block Configuration screen and change the area on which to display it and maybe limit it to only those kinds of product displays. admin/structure/block

4) View your Product Detail page now. Should look pretty similar

Josh Miller
Answer by: Josh Miller
Posted: Aug 8, 2013

Comments

Your amazing.

So many thanks for the explanation.
Its pretty fast but i can review it again step by step..
I'll keep you informed.

Thanks again mate.

bEngel

- bEngel on August 9, 2013

Hi Josh,

I'm very sorry for the late reply, due to busy times.

But... I fixed it :-)
and it wasn't hard to do it at all.

I still have a question left.
Maybe i'm a little immodest, but is it also possible to make this work when creating a list of products, where every product has its variations as just explained by you?

If not, do you know how to fix this in another way?

Thanks in advance,

bEngel

- bEngel on October 7, 2013

Dear Josh Miller, this was exactly what I was trying to achieve.. After a few days of searching and trying with page views, grouped fields and several modules I almost gave up. Then I found this post. Thank you so much! I didn't know it was that easy!! Thank you for sharing! Pip

- PipB on January 23, 2014

Hi Josh, thank you so much for this post.

Is anyone getting error once the views is set up? When I finish every step I get the following

Notice: Undefined index: node in views_handler_field_field->access() (line 127 of /Applications/XAMPP/xamppfiles/htdocs/drupal-commerce-sandbox/sites/all/modules/views/modules/field/views_handler_field_field.inc).
Notice: Undefined index: node in views_handler_field_field->query() (line 186 of /Applications/XAMPP/xamppfiles/htdocs/drupal-commerce-sandbox/sites/all/modules/views/modules/field/views_handler_field_field.inc).
Notice: Undefined index: entity keys in views_handler_field_field->query() (line 198 of /Applications/XAMPP/xamppfiles/htdocs/drupal-commerce-sandbox/sites/all/modules/views/modules/field/views_handler_field_field.inc).

When I go to views settings [show the SQL query] I get the following error when I put node/1 in the Preview with contextual filters

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS node_, commerce_product_field_data_field_product_family.product_id AS commerc' at line 1

Any input is much appreciated.

Thank you

- Eric Huang on October 13, 2014