3 replies [Last post]
antsa's picture
Joined: 02/18/2013
Juice: 52
Was this information Helpful?


I'm working on a Drupal 7 / Ubercart 3 site, and I'm currently theming the product pages.

The problem I'm facing is that when all the product images I upload are show up the same size. What I'd like to do is to have the first product image as the class uc_product and the rest of the images as the uc_product_list class. I would also like have the thumbnails on one line instead of being on multiple lines (see attachment).

I have colorbox installed and functioning well.

At the moment my node--product.tpl.php looks this for the images:

  <?php  if ($view_mode == 'teaser')
Screen Shot 2013-04-08 at 12.50.54.pngScreen Shot 2013-04-08 at 12.50.54.png123.47 KB
antsa's picture
Joined: 02/18/2013
Juice: 52
Re: Product image thumbnails Ubercart 3

I got it solved. It might not be the best way to do it, but I made it through a content field. I created a field called productimage and created a field--field-productimage.tpl.php for it. Here's the content of that template file.

<div class="<?php print $classes; ?>"<?php print $attributes; ?>>
echo '<a href="' . file_create_url($element['#object']->uc_product_image['und'][0]['uri']) . '" class="colorbox" rel="' . $element['#object']->nid . '"><img class="image-style-uc-product" src="' . file_create_url($element['#object']->uc_product_image['und'][0]['uri']) . '" alt="' . $element['#object']->title . '" title="' . $element['#object']->title . '"width="400" height="400"/></a><br>';
$images = $element['#object']->uc_product_image['und'];
$maara = 1;
$kuvat = count($images);

        while (

$maara <= $kuvat):
$kuva = file_create_url($element['#object']->uc_product_image['und'][$maara]['uri']);
'<a href="' . $kuva . '" class="colorbox" rel="' . $element['#object']->nid . '"><img class="image-style-uc-thumbnail" src="' . $kuva . '" alt="' . $element['#object']->title . '" title="' . $element['#object']->title . '" width="100" height="100"/></a>';


Attached is a screenshot of the working site.

Screen Shot 2013-04-10 at 10.53.13.png 299.74 KB
holljac's picture
Joined: 11/13/2011
Juice: 5
Product display style

It's been a long time since you posted this but I hope you get this message. This looks like how I would like to display multiple pictures of products. Can you help me understand a few things?

When you created the file "field--field-productimage.tpl.php", where did you place it. In the theme folder or in one of the ubercart subfolders, like ubercart/uc_product?

When you say you created a new field, I assume you meant in the content type "product" with a type and widget of "Image". Is that correct? Manage display is set to colorbox with 100x100 thumbnail, etc?

If you could help me, I would be eternally grateful...


anil's picture
Joined: 01/08/2014
Juice: 3

Dear Sir,
I am beginner in drupal. I have working on a e-commerce project. I use ubercart module. I create more product post. but really i want like this :


plz check it.

Plz help me sir.

what requirement