Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Notice: Undefined index: in commerce_product_reference_default_product() (line 1478 of ..... /commerce/modules/product_reference/commerce_product_reference.module)
My otherwise happy install started throwing this error after bringing core, commerce and dependent mods up to date. Can't seem to shake it. Help! (Please.)
Comment | File | Size | Author |
---|---|---|---|
#1 | 1967262.default_product.patch | 861 bytes | rszrama |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedAhh, drat. Naturally you find the use case that breaks a new feature after rolling the release. The reason you have this issue is because we added this function in Commerce 1.6 to allow other modules the opportunity to implement different rules for determining the default product in a multi-value product reference field. However, all of our tests were with actual data in the field. In your case, you have an empty multi-value product reference field, so when it goes to try and determine the default product in the group, it comes up empty. Hence the notice.
In truth, this function should never be called with an empty array. I've fixed the place that allowed this to happen to no longer attempt to do so. Either apply the attached patch or update to 7.x-1.x-dev to have the fix.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/26608da
Comment #2
noelgross CreditAttribution: noelgross commentedPerfecto! Updating to the latest dev did the trick. Thanks, Ryan!