In your example page you are showing "Standard Settings With Gallery". There is a big image and three thumbnails to change the big image. Is this possible "out of the box"?
Very nice module!
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | problem.jpg | 225.18 KB | Heihachi88 |
Comments
Comment #1
gekido commentedyou will need to create a custom theme override for whatever content that you are wanting to display, something like so (this is a mish mash of stuff i've copied & modified from other posts around the interweb).
This is an example of using the cloudzoom to theme an ubercart product display as a custom themed node-product.tpl.php
it's pretty liberally commented and hopefully 'should' be somewhat straightforward to customize for your own purposes. for example, copy this and save it as node-product.tpl.php and upload it to your theme's directory - it should work 'out of the box' in theory assuming you have the imagecache, cloudzoom & ubercart modules installed.
note: You do NOT need an 'image handler' setup in ubercart to use cloudzoom for image handling in ubercart.
any improvements or comments that anyone can provide to clean this up and/or make it more generic is greatly appreciated.
Comment #2
Tara Rotten commentedHey I tired your method and i cant get it working for me does anyone know how i can get thumbnails that swap the main image?
Comment #3
Tara Rotten commentedI got your code working its amazing thank you! Only one thing have been racking my brain for hours as it does not display a intial image when you first arrive at the page..it just has the loading symbol until you click a thumb nail..help??
Comment #4
Tara Rotten commentedI got your code working its amazing thank you! Only one thing have been racking my brain for hours as it does not display a intial image when you first arrive at the page..it just has the loading symbol until you click a thumb nail..help??
Comment #5
orkineo commentedMany thanks for your code, works perfect!
Comment #6
gekido commentedQuick followup in case it wasn't obvious.
In the places where I'm writing the image tags above, I have (currently) hard-coded the actual imagecache preset into the link (for lack of finding a way to do this properly).
So where I have:
Where it has:
and
You will need / want to specify the actual imagecache presets that you want to use for your display. This way you can customize / add whatever imagecache presets that you want to your system (with whatever names you want) and it will display properly.
Hope this helps clear up some confusion about the process (maybe?).
Also note that the above template isn't doing any proper error checking and does currently have 'issues' (ie displays an error) if the product display does not have any images associated with it. I'm going to have to (for the site I'm working on) update / fix this but haven't gotten around to doing so yet.
Enjoy!
Comment #7
Clint Eagar commentedWorks for me, thanks for posting.
Comment #8
Clint Eagar commentedI'm having a problem and I hope you can help. Have a look at: http://www.ohkaty.com/oh-katy-one-size-pocket-diapers notice when you change images (by clicking the thumbnail) then active cloud zoom how the image title displays the old image title? Here is my code:
Comment #9
gekido commentedYeah I've noticed the same thing on my dev site as well. The problem is this chunk of code for the 'main image display':
alt='print $node->field_image_cache[0]['data']['alt'];' title='print $node->field_image_cache[0]['data']['title'];'Notice how it's grabbing the alt & title text from the image, index of [0]? That's the problem. Basically need to update the alt & title text with the active image's text instead of simply hard-coding the text.
Having said that I don't have a fix for the code at the moment, haven't worked on this much since my original post unfortunately. When I have time and get back to working on my product templates again I'll post whatever I figure out.
Hope this helps
Comment #10
Clint Eagar commentedSolution:
A a new line after line 365 in the cloud-zoom.js file:
// Change the small image to point to the new small image.
$('#' + data.useZoom + ' img').attr('src', event.data.data('relOpts').smallImage);
$('#' + data.useZoom + ' img').attr('title', event.data.attr('title'));
Then add the title to the image link not the image src.
Works here: http://www.ohkaty.com/oh-katy-one-size-pocket-diapers
Comment #11
gekido commentednice - good to see that it's working for you!
Comment #12
lokuputha commentedI am having problem hope you can help me. I have followed your instruction and big image zooming is fine. Problem is when I click the thumb images; big image disappear and message keep displaying “Loading...” I am newbie to drupal. I haven’t changed any line in cloud_zoom.module or cloud-zoom.1.0.2.min.js files.
Do I have to include the “cloud-zoom.1.0.2.js” file to “cloud_zoom.module.php” file?
If so please kindly enlighten me how it done.
Here is my code:
Comment #13
sittard commentedThis is my version, posted here to help others.
Comment #14
Lisa Josephsen commentedHello,
I am a complete non-programmer and really just trying to pull this together quickly. I have it started with the first large image working, but I can't seem to get the thumbnails to work. When I click on a thumbnail, it redirects to a new page. I have some javascript making the thumbnail process work and I'm wondering if I need to delete it. Any help would b appreciated!
Comment #15
stephenward commentedI've posted my solution here. I'd link to the live example, but it's still in development.
http://www.wardontheweb.com/how-to-enable-ubercart-product-image-zoom-wi...
Comment #16
Lisa Josephsen commentedStephen...Your solution worked perfectly for me! Thank you. Can you tell me where to add css to add padding to the thumbnails?
Thank you so much
Comment #17
stephenward commentedSure thing, Lisa. Each of the thumbnails has the "cloud-zoom-gallery" class, which is used by Cloud Zoom but can be used just as easily for CSS. Something like the following in your theme stylesheet should do the trick:
.cloud-zoom-gallery { padding:5px; }
Comment #18
Heihachi88 commentedComment #19
Heihachi88 commentedHey, guys! Can u help me with displaying Large image on hover. U can see this in attached image at the end of my comment. I want the picture in #cloud-zoom-big larger like on the site http://www.ohkaty.com/oh-katy-one-size-pocket-diapers
I've used this code in node-product.tpl.php:
and in display fields of field_image_cache i've set Cloud Zoom: Product Full → Product Full. When i change the display type its kinda doesnt work.
Comment #20
dhinvin commentednode-product.tpl.php in that file comment your image div tag.
after that use this code it will work perfectly.
use this attached file code
Comment #21
Heihachi88 commentedWhich code and which file?
Comment #22
CanOne commentedthank you sittard
i dont get any errors from your code and its showing the gallery the right way
but the zoom is not working..a click on the default image shows the zoom image in a new page
same if i click on a thumbnail..
whats the issue?
edit: solved the problem
the field view on the content type was set to hidden
Comment #23
steharg commentedIve got the same problem with the title of the zoomed images not changing
here is my code:
Also - does anyone know how I would get the titles of the images below each thumbnail?
Comment #24
diwakar commentedhi StephenWard,
sorry, the link you have posted is not working "http://www.wardontheweb.com/how-to-enable-ubercart-product-image-zoom-wi...",
can you please give an alternate to the same, thank you
Comment #25
stephenward commentedMy site was down for a bit last week, diwakar. The post is back up now if you still care to read it.
Comment #26
diwakar commentedHi Stephen, Great, Thank you very much, it was very helpful and it worked perfectly
Comment #27
diwakar commentedHI,
have used the below code (by StephenWard - great help) to display the products, it was working great for some time and then..., the second image does not load,
the url for the image shows "/sites/default/files/imagecache/product_full/sites/default/files/600.jpg" instead of
"/sites/default/files/imagecache/product_full/600.jpg"
pl suggest, thank you
Comment #28
jackhutton commentedthis looks very useful;
I'm trying to integrate cloud zoom w. an ubercart product on drupal 7 ( d7) Any help/thoughts with this
thanks..
Comment #29
kristin.e commentedPost #13 @sittard's example worked for me with a bit of added styling for my site. Thanks!
Comment #30
JHuxley commentedThis is based on sittard's code, but should do the job for D7. Replace image styles where needed.
Comment #31
filoquin commentedin mytheme template.php
/**
* Formats a product's images.
*
* @ingroup themeable
*/
function mytheme_uc_product_image($images, $teaser = 0, $page = 0) {
static $rel_count = 0;
// Get the current product image widget.
$image_widget = uc_product_get_image_widget();
$first = array_shift($images);
$output = '
$element['#item']=$first;
$element['#formatter']= 'imagefield__cloud_zoom__product__product_full';
$output .= mytheme_cloud_zoom_formatter_imagefield($element,array('class' => 'cloud-zoom','id' => 'zoom_product'));
$output .= '
foreach ($images as $thumbnail) {
// Node preview adds extra values to $images that aren't files.
if (!is_array($thumbnail) || empty($thumbnail['filepath'])) {
continue;
}
$element['#item']=$thumbnail;
$element['#formatter']= 'imagefield__cloud_zoom__uc_thumbnail__product_full';
$smallImage = imagecache_create_path('product', $element['#item']['filepath']);
$output .= mytheme_cloud_zoom_formatter_imagefield($element,array(
'class' => 'cloud-zoom-gallery',
'rel' => "useZoom: 'zoom_product', smallImage:'$smallImage'"));
}
$output .= '
';
$rel_count++;
return $output;
}
/**
* Theme handler for the cloud_zoom effect
*/
function mytheme_cloud_zoom_formatter_imagefield($element,$attributes = array('class' => 'cloud-zoom')) {
if (!_cloud_zoom_files_present()) return;
// Add the cloud zoom JS and CSS
drupal_add_js(drupal_get_path('module', 'cloud_zoom') .'/cloud-zoom/cloud-zoom.1.0.2.js');
drupal_add_css(drupal_get_path('module', 'cloud_zoom') .'/cloud-zoom/cloud-zoom.css');
// Get the view and zoom presets from the formatter ID.
list($tmp, $cloud_zoom_type, $view_preset, $zoom_preset) = explode('__', $element['#formatter'], 4);
// Theme the preview image using imagecache
$small = theme('imagecache', $view_preset, $element['#item']['filepath']);
// Return the preview image as a link to the larger image with a cloud-zoom CSS class
return l($small, imagecache_create_path($zoom_preset, $element['#item']['filepath']),
array('html' => TRUE, 'attributes' => $attributes));
}
Comment #32
ideal2545 commentedI have no clue why, but i could only get this to work if I added the first line from JHuxley (for D7):
Comment #33
rituraj.gupta commentedThanks ideal2545. You are good. You saved my time.. :)
Comment #34
lsolesen commented