Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.1
Component:
Commerce
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2011 at 20:14 UTC
Updated:
22 Dec 2011 at 17:50 UTC
I have an issue that is somewhat similar to: #1163066: Add the ability to use radio buttons on the Add to Cart form and #1038320: Replace the "magic configuration" of attribute fields with explicit settings
I am able to change the add to cart form select list to display as radio buttons with this code:
function mymodule_form_alter(&$form, $form_state, $form_id) {
if (substr($form_id, 0, 30) == 'commerce_cart_add_to_cart_form') {
$form['product_id']['#type'] = 'radios';
}
}
Although it is functional, I see the following error:
Notice: Undefined index: #options in form_process_radios() (line 2933 of xxx/src/includes/form.inc).
Does anybody know why this error is happening?
Comments
Comment #1
rszrama commentedI'm guessing the problem is that your code is getting executed for both single and multiple product Add to Cart forms, causing this error to show up on single product forms where $form['product_id'] is normally going to be just a hidden field without an #options array.
Comment #2
rszrama commentedDefinitely meant to mark fixed. : P
Comment #3
lexfunk commentedYou were absolutely correct @rszrama. Thank you for your help.