Product Order - How to add product option information to the order

I have tried several different configurations and the only suitable one seems to be using product options. It seems I have too many products to create individual products for 10 different attributes. Ended up with over 3 million products and my server didn't like a db that large (over 10GB)

So when I use product options with pricing attributes I get the dynamic pricing per option, but on the orders I have no way of knowing which option the customer chose.

Unless I am missing something simple.

-3 sizes assigned prices in a single option set using pricing attributes
-product_types referencing this option set using a Pricing Attributes field
-products with a Product Reference field
I can add content, and add new product to that content, which has a base price and an Attributes selector. Selecting the attribute adds the options set to the product and shows up as a list of options on the product display page. Making a selection modifies the product price. Adding to cart adds to cart using product title and sku, but nothing (besides the price) indicates which option was chosen)

I hope this makes sense.

Is there a way to append to the title or sku (or anything else that makes sense) information about the selected option?


Posted: May 9, 2013


Banzai on May 11, 2013

Hello Lowell,

You can edit the view that displays the orders and add a product relationship and then add the fields that you need, this is just an idea, haven't tested it.

Lowell on May 13, 2013

It sounds like it'll work perfect, and I might have to build my own views. But to understand views better is a good idea.

Using the Commerce Order view, the one displayed on the cart page, I can't add a product relationship. Something is restricting the options to mostly commerce order: and user: relationship options.

Banzai on May 13, 2013

In the orders view at the relationships look for Commerce Line item: Referenced product add this and then you can add the SKU or other fields related to the product, but I don't know how it will react when you have multiple products in the order, haven't tested, but you can play with it and find out. I hope this will help you!

Lowell on May 13, 2013

I did find the Commerce Line Item: Referenced Product relationship, and it did give me more fields, however I had to use a different view. the Commerce Orders view did NOT have that relationship available.

The view which DID have it available was still unable to retrieve/display the values I need. It seems they are not available to views as they are not provided by the Commerce Pricing Attributes and Product Options modules.

So to summarize my position, the cart (for example) shows the product title/sku/price/etc, whatever I can add via views.
But it does not show the chosen option, I can only get it to show the label for that options field.

Also, I have a one product display referencing one product type which in turn references multiple options. So one sku for multiple options, each option is associated with a different price, I'm allowing only a single option to be chosen per add-to-cart click. For now I can use the price of the purchase to determine what has been purchased but it seems silly to not be able to show which option was chosen.

I have looked into the db tables to find the per-price line item, and I found them in the field_data_commerce_unit_price table serialized. There does not seem to be any reference to the option, just contains the price of the option.

So it seems my solution is to patch one of the modules so that it feeds the option as well as the price to the line item/unit price table.

Maybe I am missing something with the standard views fields, if not, any ideas on how I can proceed otherwise.