Notice: Undefined index: alt in uc_product_get_picture() (line 1840 of /path/to/drupal/sites/all/modules/contrib/ubercart/uc_product/uc_product.module).
Notice: Undefined index: title in uc_product_get_picture() (line 1840 of /path/to/drupal/sites/all/modules/contrib/ubercart/uc_product/uc_product.module).
The alt and title attributes are nested within the 'data' array of the returned $image
Comments
Comment #1
longwaveConfirmed, tested and committed. Thanks!
Comment #2
tr commentedWe keep going back and forth on this. See the first few results at http://drupal.org/project/issues/ubercart?text=%24image['data']['alt']&status=All&priorities=All&categories=All&version=All&component=All for some history of the issue. Perhaps it has something to do with imagefield version or some other unknown factor, but experience shows that someone is going to complain about this fix and request the exact opposite.
Comment #3
longwaveAs far as I can see in imagefield itself, this change was made three years ago:
http://drupalcode.org/project/imagefield.git/commitdiff/f01da49
http://drupalcode.org/project/imagefield.git/commitdiff/e917e80
But perhaps we should do something like this?
Comment #4
longwaveor maybe
Comment #5
tr commentedLet's just leave it the way it is for now, with the original patch committed. Looking at http://drupal.org/node/742084#comment-3595762 it sounds like Lyle intended to make it look like $image['data']['alt'], $image['data']['title'], but I don't see a record of that commit. So I suspect part of the confusion is that the code was never changed to reflect the discussion in the issue. If it has been that way for three years then we shouldn't have to cover for the old, unsupported, unpublished version of Imagefield that uses the old style.
Comment #6
longwaveuc_product_table() had a similar issue so I changed that code as well.
http://drupalcode.org/project/ubercart.git/commitdiff/045bbd7
Comment #7
longwaveLyle's commit was http://drupalcode.org/project/ubercart.git/commitdiff/31e9423 but didn't change all instances, so (fingers crossed) this issue is solved once and for all.
Comment #8
tr commentedAh, that explains why I didn't find it - I was tracing line 1840, which didn't get fixed. It also explains why various people in those issues were seeing different things - some were evidently looking at output of uc_product_get_picture(), which was not fixed, and some were evidently looking at the output of theme_uc_product_image(), which *was* fixed.
Comment #9
grafikchaos commentedLooks like I missed an earlier call to the $image['alt'] and $image['title'] that I originally posted. I've attached an additional patch for the one I missed
Edit: OOPS! I missed longwave's comment in #6, these are identical patches so just use that one and I wish I could delete this comment.
Comment #10.0
(not verified) commentedprettied up my original post by adding code tags around the php notice messages