Where is the product image in products with no options
glyphman - October 22, 2008 - 02:10
| Project: | Ubercart Option Images |
| Version: | 5.x-1.0-3 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I seem to be missing something. When I activated Option Image, a new image was added to the product page besides the one supplied by Ubercart. So I turned the Ubercart-supplied image off. This works great for products with options - they show the option images perfectly. But I added a product that had no options - I get no image. Now I am confused and wondering if I left something out.

#1
I am not certain what the best way to go for that would be, I suppose just a quick conditional in the node.tpl.php or whichever theme you are using to display either the regular UC image or the option_image when its available. Personally all of our clients have always had option-based products with variants of colors etc so I cannot say exactly
#2
Thanks, I may do that. My client may be happy with multiple images in Thickbox, I just wanted to make sure I was not missing anything. BTW - the video was very helpful.
#3
Great to hear! UberCart can be a little daunting so I figured a quick video would help out
#4
Automatically closed -- issue fixed for two weeks with no activity.
#5
Does anyone know how the code for this would look?
tjholowaychuk said:
For the store I'm working on, not all items require options. I need to display the product image for those that don't, and the options_image for those that do. I'll bet this is pretty common after all.
Thanks!
#6
The problem I mentioned is on Drupal version 5.12
#7
I'm not sure if this is along the same lines, but I feel that if an option doesn't have an image attached, the default image uploaded with the product should be used, and only then if there isn't a default image, should 'No Image' be shown.
Sometimes I have lots of options, but I don't have images for all of them, so the default uploaded image should show up instead of 'No Image'. Also, maybe for certain products I don't have a need to show different photos, so the default should just show up.
Cheers,
Stephanie
#8
For sure, however when I implemented this quick module we had no need for regular UC images, but like i mentioned to the others im willing to give CVS access to additional developers to make these changes if they wish.
#9
Stephanie, I agree, it would be great if it could work that way.
It would be extremely helpful to have option images, and it seems most of the work is done, yet it's out of reach for me. We can't do away with all the regular product images, because many products have no attributes at all. Does anyone know where something similar has been done? I can poke around in tpl files, but I'd need a good example before I could even begin to come up with the necessary conditional. Even so it's would be a very long shot.
#10
Unfortunately I cannot do this for you guys, sad reality of open source projects I suppose. I am sure someone out there has made the tweak though, hopefully they can post a good example.
#11
I came up with a fix that works for me to display the main image if no option image is uploaded. You just need to put the following code in your template.php file, changing 'zoozee_V1' to the name of your own theme:
/**
* Theme the no image placeholder.
*/
function zoozee_V1_uc_option_image_no_image($node, $size = '_original') {
$attributes = array('class' => 'uc-option-image');
$filename = $node->field_image_cache[0]['filepath'];
if ($size != '_original'){
return theme('imagecache', $size, $filename, t('No Image'), NULL, $attributes);
}
else {
return theme('image', $filename, t('No Image'), NULL, $attributes, FALSE);
}
}
/**
* Theme the no image placeholder. Must be a valid imagepath.
*/
function zoozee_V1_uc_option_image_no_image_path($node, $size = '_original') {
$filename = $node->field_image_cache[0]['filepath'];
if ($size != '_original'){
return imagecache_create_url($size, $filename);
}
else {
return $filename;
}
}
#12
Excellent, works perfect for me too..