Hi,

I had a problem displaying submission data that was under a condition of product quantity.

After a bunch of dpm's I found it in productfield.inc, _commerce_webform_get_selected_products_from_input_values. I didn't fix the case of multiple products, but for single products there's a line

$selected_products[$input_values[0]] = $input_values[1];

which I replaced with

$prod = json_decode($input_values[0]);
$selected_products[$prod->product_id] = $prod->quantity;

Sorry no patch for that, I didn't test it well yet and the case of multiple products needs to be done also.

Comments

lurkingbeast’s picture

Good that I didn't create a patch, the above solution was a bit hasty since I didn't test it.

So the above code change works for the user/#/orders/# page, and correctly lists everything. But then it fails in other places of course.

The problem seems to be in the input values, in user/#/orders/# -page the element doesn't go through commerce_webform_productfield_expand so the quantity calculating fails.

lurkingbeast’s picture

Issue summary: View changes

edited typo in code

ar-jan’s picture

Title: Conditionals based on quantity » Submission values depending on a commerce_webform component as condition are not displayed
Issue summary: View changes

I have the same problem, but with submission data that is under a condition of "is a product". When I view the submission (via node/123/submission/456), the submitted data that depends on the selected product is not shown, but when editing the submission, it is there.

Should checking for conditions even happen when viewing a submission, or should it just show all submitted values? (Edit: yes, it should, since we don't need to show the labels for the dependent components on submissions not meeting the condition).

xax’s picture

Absolutely delighted with the conditionals working in the dev version. Using this in a conference registration form. It allows users to to choose from full attendance 'product' and one day attendance 'product', in the last case a choice of day appears. Also gives a choice for student registration 'product', in which case a file upload for proof of status appears. Brilliant..

However, before I installed the DEV version, when I had these conditional fields as permanent fields, they were sent along with the confirmation email. Now the chosen day or student status do get registered/uploaded, but they don't appear in the confirmation email to the person registering.. Any way to change this?

tmai82’s picture

No update or patches on this? This is a necessity for something I am working on. I'd love to see this fixed. The ability to select a product and have other fields shown based on the product selection is a vital part of the webform I am working on. Or even the reverse of that, being able to "set to" the commerce_webform field.

johnennew’s picture

Status: Active » Fixed

I believe this has been fixed by #2464855: Conditionals not working with commerce product sku fields which is now committed into 7.x-2.x HEAD. I'll be producing a new tag release soon which includes this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.