I got the following error message twice when creating four products using two attributes each, both implemented as taxonomy term references:

Warning: Invalid argument supplied for foreach() in commerce_bpc_commerce_bpc_get_combinations() (line 54 of /Volumes/Fat_G5/htdocs/sites/all/modules/commerce_bpc/commerce_bpc.hooks_list.inc).

The products seemed to have been created OK, though. Looking at the above referenced code with a debugger revealed that the $fields variable is null because $form_state['commerce_bpc'] contains no array named 'list'. It contained only a 'commerce_price' and a 'bpc_taxonomy' sub array, where the 'bpc_taxonomy' sub array in its turn contained a 'combination_fields' sub-array, which seems to be what the code is looking for here. That's as far as I got. Let me know if you need any further information to reproduce this problem.

.JM

Comments

TheWizz’s picture

This seems to happen when all combination fields are of taxonomy reference type; i.e., no List(text) items. If there's at least one List(text) item, the bug doesn't appear. Hope this additional info helps.

Possibly related problem. When I changed to use a List(text) for T-shirt sizes, they appear as checkboxes on the bulk add form, and at the top of the foerm I get this warning:

Warning: Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2233 of /Applications/MAMP/htdocs/d7Yo/includes/form.inc).

Again, adding prtoducts still seem to work. Changing the Product Type fields to display the T-shirt sizes as a select list instead of "check boxes/radio buttons" made the above warning go away (although the sizes are still displayed as checkboxes on the bulk add form). If you believe this warning is unrelatedm, Iäd be happy to move this problem into a separate issue.

-JM

sven.lauer’s picture

You are right, this issue only arises when there are no list field. The problem was that one of the hook implementation for the list module still assumed that at least one list field would be present.

I just committed a fix (I had actually already noticed this problem and had a fix on a working branch).

There should be no problem with the unfixed version besides the annoying notices.

sven.lauer’s picture

The last comment is about the original issue, the other one is likely unrelated. Let's discuss it here anyways.

I've just been able to reproduce the second notice, and I am still investigating.

That the options (for list fields) are always shown as checkboxes is the intended behavior (for now, though I've put up the task #1263976: Allow site builder to decide between radios and a multi-select widget for list fields to have list field behave like taxonomy fields).

sven.lauer’s picture

Status: Active » Fixed

And fix, no. 2.

The problem was that the form API type "checkboxes" requires a default value, which is not (necessarily) present in the field API widget at the time it is altered by bpc. The problem was shadowed by the fact that the value is present if the original widget is a select list.

Thanks!

Status: Fixed » Closed (fixed)

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