Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
lurkingbeast CreditAttribution: lurkingbeast commentedGood 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.
Comment #1.0
lurkingbeast CreditAttribution: lurkingbeast commentededited typo in code
Comment #2
ar-jan CreditAttribution: ar-jan commentedI 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).Comment #3
xaxAbsolutely 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?
Comment #4
tmai82 CreditAttribution: tmai82 commentedNo 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.
Comment #5
johnennew CreditAttribution: johnennew at Deeson commentedI 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.