Digging into Ubercart, this is the theme function you are talking about:
/**
* Formats a product's images.
*
* @ingroup themeable
*/
function theme_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 = '<div class="product-image"><div class="main-product-image">';
$output .= '<a href="'. imagecache_create_url('product_full', $first['filepath']) .'" title="'. $first['data']['title'] .'"';
if ($image_widget) {
$image_widget_func = $image_widget['callback'];
$output .= $image_widget_func($rel_count);
}
$output .= '>';
$output .= theme('imagecache', 'product', $first['filepath'], $first['data']['alt'], $first['data']['title']);
$output .= '</a></div><div class="more-product-images">';
foreach ($images as $thumbnail) {
// Node preview adds extra values to $images that aren't files.
if (!is_array($thumbnail) || empty($thumbnail['filepath'])) {
continue;
}
$output .= '<a href="'. imagecache_create_url('product_full', $thumbnail['filepath']) .'" title="'. $thumbnail['data']['title'] .'"';
if ($image_widget) {
$output .= $image_widget_func($rel_count);
}
$output .= '>';
$output .= theme('imagecache', 'uc_thumbnail', $thumbnail['filepath'], $thumbnail['data']['alt'], $thumbnail['data']['title']);
$output .= '</a>';
}
$output .= '</div></div>';
$rel_count++;
return $output;
}
First off, I hope you didn't go in there and start hacking away, but rather copied the above to your theme's template.php file and renamed it YOURTHEME_uc_product_image()
and made your modifications there :) But, either way, from the declarations of this theme function, the only data you have to work are in the $images
argument plus anything uberfunky returned by ub's image_widget. You might want to throw in some debug code to see if anything in there is what you are looking for like this:
drupal_set_message('<pre>' . print_r($images, TRUE) . '</pre>');
at the start of your copied function. Just remember to clear your caches/theme registry so drupal sees your function.
<div class="product-image"><div class="main-product-image"><a href="" title="Test Product">
it totally ignored my url! so it probably is because $node is not defined. do you know if there's an easy way to solve this?