Products with attributes who have no images try to show images anyway

chellman - September 24, 2008 - 02:44
Project:Ubercart Option Images
Version:5.x-1.0-3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

Inside the view case of uc_option_image_nodeapi, you're checking if a node has attributes, but not whether the option_images have been loaded in the load case. This means that even in cases where an image shouldn't be shown, this module is trying to show one.

I've added a test for $node->option_images, and if none is found, no attribute images are shown. I think you could probably ditch the check of node attributes and just check for the option_images since that work was already done in the load step, but my experience with this module is limited, and I didn't want to screw anything up.

The attached patch seems to take care of this without ill effects.

AttachmentSize
uc_option_image.patch614 bytes

#1

scottrigby - November 15, 2008 - 21:28
Status:needs review» reviewed & tested by the community

Hi chellman, patch works like a charm - Nice work ;)
Marking RTBC because it doesn't look like this is going to get tons of people testing this -- though ideally it'd be integrated into the next release if the is one.

#2

jesperholm - July 22, 2009 - 08:54

Where am I supposed to put the code? I'm guessing in the uc_option_image.module, but where?
I just tacked it on the end, and it blocked the view of my whole site!

#3

chellman - July 22, 2009 - 15:08

@jesperholm: This is a patch. Learn how to use it here: http://drupal.org/patch/apply

#4

jesperholm - July 23, 2009 - 13:14

Ok. Applied the patch, but I still get the camera with a red strike-through as my default picture, even though there is no image set. Don't know what I'm doing wrong, but it's a bit frustrating. My other problem is that the option images are getting saved to the wrong link. I know it's not this post, but I'm now getting any help from other sources, so maybe someone could help.

I attach the image by cycling through to the right link (localhost:8888/mysitename/sites/default/files/option-images/eg_0.jpg) and the default image is fine, but when it comes time to choose the option, the link changes to localhost:8888/sites/default/files/option-images/eg_0.jpg without the 'mysitename' in the link, and all I get is the evil blue question mark of death. It seemed to work the first time I tried it, but now none of them work! HELP!

#5

donquixote - November 24, 2009 - 10:02

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.