I get this error message when I edit or create a subscription
Notice: Undefined offset: 2 in uc_price_per_role_form_alter() (line 227 of xxx/modules/new/uc_price_per_role/uc_price_per_role.module).
Notice: Undefined offset: 1 in uc_price_per_role_form_alter() (line 227 of xxx/modules/new/uc_price_per_role/uc_price_per_role.module).
And doesn't assign the role to the paid user
Thanks
Comments
Comment #1
3rdLOF commentedI get a similar error when viewing a product.
Comment #2
goodeit commentedI have this issue as well. It appears that going to the option prices page (node/#/edit/option_prices) and filling in all the empty boxes with 0s will make most of the messages go away. I'm looking into a way to fix this and make the values default to 0.
Comment #3
goodeit commentedOne of the messages I was getting was an
undefined offset:with an empty offset. This is due to the attributes array #options index including "Please select" as an empty offset:To work around this, I changed line 227 to the following:
I'm still working on setting the default values if the options are not in the database.
Comment #4
goodeit commentedI realized that instead of setting default values for every attribute option for every role, it's much better to let the existing defaults take over when the option price for a particular role is blank.
Thus, the fix is very simple, and in fact can be found another place in the price per role module (line 369): simply check if the uc_price_per_role_load_option_prices() call returned a new price for that particular option using
isset($role_prices[$oid]).Here is a solution that takes care of both the empty offset message mentioned in #3, and the errors from #1 and #2. This code replaces line 227:
Comment #5
DanZ commentedCommitted #4, thanks!