Warning: json_decode() expects parameter 1 to be string, array given in commerce_webform_get_products_from_webform_submission() (line 278 ...sites/all/modules/commerce_webform/commerce_webform.module).
I don't know what went wrong. My first day with webform in commerce. If you need mor informations because of the error please ask me.

THX in advance

maen

Comments

maen’s picture

Solved it:

line 277:

     foreach ($component['value']['value'] as &$value) {

that's it ...

skyredwang’s picture

Status: Active » Needs review
Jabbtech’s picture

StatusFileSize
new618 bytes

reviewed and tested, patch attached.

johnennew’s picture

Status: Needs review » Closed (fixed)

Thanks all for reporting this. Fix is tested and is now in the development branch and will appear in the next release.

Kind regards

John

micnap’s picture

Status: Closed (fixed) » Needs work

This patch didn't work for me. After applying, the form gets submitted without anything being added to the cart.

Mickey

johnennew’s picture

Status: Needs work » Postponed (maintainer needs more info)

Hi Mickey,

Were there any errors? Are you using the latest dev branch or beta4? I've run through this on a basic Drupal setup with latest commerce and webform without issue.

Could you also provide the options you set on your product field?

1. How many product skus do you offer?
2. Is multiple ticked?
3. Is "Allow the user to set the quantity" ticked?
4. Is List box ticked?
5. Is mandatory ticked?
6. Have you provided a default sku?

Kind regards,

John

aidanlis’s picture

StatusFileSize
new2.84 KB

It's not working for me with the latest --dev (both commerce_webform and commerce). Look at the structure of the array: http://share.aidanlister.com/JfEU

1. Just one
2. Nope
3. Nope
4. Yes
5. Yes
6. Yes

I've attached a patch which fixes the issue for my case.

Aside: My patch also resolves a bug whereby you can't see the webform submission on the commerce order page -- you've appended a renderable array as a string which isn't going to work. I've split this into two keys and made one a label, so that it looks pretty: http://share.aidanlister.com/Jeo9

karing’s picture

ad #1 - We've been using commerce_webform -dev to process cafeteria orders for a school for weeks now and we have not seen such notices. Things are working very very well. The webform is a massive grid of product skus (over 200) + quantity selectors in the pizza section (#slices). And I just verified we're indeed using:
foreach ($component['value'] as &$value) {

ad #7 - We're seeing the webform submissions on the commerce /user/%/orders/% pages. No issue there either.

Probably comes down to how the webform is put together?

johnennew’s picture

Thanks both for your comments, I can try and replicate now. KarinG - what is your setup as per the questions in #6 so I can compare with what aidanlis reports in #7.

Kind regards
John

karing’s picture

StatusFileSize
new38.12 KB
new84.23 KB

Hi John,

I've got: attached 2 pngs - give you an idea of what the webform looks like.

1. How many product skus do you offer? - as many as up to 181 on our most complex webform
2. Is multiple ticked? - yes for the rows you're looking at so in Webform eg:

Label = Mo. Oct. 01
Multiple
Half, Full, Milk, Chocolate milk, Soy milk - vanilla, Juice, Fruit cup, Yogurt, Special
(the 9 product skus on this row).

3. Is "Allow the user to set the quantity" ticked? - only for the 8 pizza options - they are by slice

Label = Pizza Cheese
Allow the user to set the quantity
Multiple
Pizza Cheese

4. Is List box ticked? no
5. Is mandatory ticked? no - not for any of the product skus
6. Have you provided a default sku? no

vlkff’s picture

The same error (no order, just redirect to webform form submit success page) happens to me, I inwestigated this problem and what is I found:
* the bad things happen when the code try to create line item of automatically created 'commerce_webform' line item type
* the commerce_webform_line_item_configuration() function not running as well, but this is not a root of the problem
* if you would manually create 'commerce_webform' line item type using Commerce Custom Line Items module and the run commerce_webform_line_item_configuration('commerce_webform') with drush, the module works fine

johnennew’s picture

Status: Postponed (maintainer needs more info) » Fixed

Hi all,

Sorry for the delay on this one. The issues reported here are due to using the alpha 4.x branch of webform which has breaking compatibility changes with modules built for the stable 3.x branch as commerce_webform is.

I have created a 2.x branch of commerce_webform which is compatible with the 4.x branch of webform. Most patches submitted on this thread are duplicates but I have applied parts of #7 by aidanlis to the 2.x branch of commerce_webform as this patch fixes the missing webform listing on the order display.

Kind regards,

hejazee’s picture

Status: Fixed » Needs review

This problem still persists in latest dev version
but #3 seems to solve the problem
#7 doesn't work.

johnennew’s picture

hejazee - what version of webform are you using and what version commerce_webform are you using?

Thanks,
John

hejazee’s picture

I was using
commerce_webform-7.x-1.x-dev
webform-7.x-3.18
------

But I tested webform-7.x-4.0-alpha6 with commerce_webform-7.x-2.0-alpha2
that works.

thanks

johnennew’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Status: Needs review » Fixed

I have tried this on a fresh Drupal install with commerce 1.4 and webform 3.18 and not seeing this problem.

Closing this issue unless other information comes out.

Status: Fixed » Closed (fixed)

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