Just installed, enabled, and set up this module on one of my roles. When I view any items in my catalog, I get the following error message:
Notice: Undefined index: #value in uc_price_per_role_form_alter() (line 213 of /home1/xxx/public_html/xxx/test/sites/all/modules/uc_price_per_role/uc_price_per_role.module).
I'm not sure why this is showing up (aside from the obvious fact that $form['qty']['#value'] doesn't exist). There is a quantity field on the page, but nothing like it in $form.
To fix it, I just added an isset() to check if there is a '#value' index:
if(isset($form['qty']['#value'])) {
$qty = intval($form['qty']['#value']);
}
else {
$qty = 1;
}
Comments
Comment #1
goodeit commentedComment #2
pfrillingI printed out the $form array and found that #value was changed to #default_value. The attached patch changes line #213 from
to
Comment #3
DanZ commentedClosed #1754732: Keep getting log message Notice: Undefined index: as a duplicate.
Comment #4
DanZ commented#value is correct. It might not be set when a new form is being altered if there is nothing in that form element yet.
Commited #0. Thanks!