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.)

CommentFileSizeAuthor
#1 1967262.default_product.patch861 bytesrszrama
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Version: 7.x-1.6 » 7.x-1.x-dev
Status: Active » Fixed
FileSize
861 bytes

Ahh, 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

noelgross’s picture

Perfecto! Updating to the latest dev did the trick. Thanks, Ryan!

Status: Fixed » Closed (fixed)

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