Can I use a custom CCK Link field as URL for Ubercart Product Image I created a custom link field for my Product content type using Drupal 6 and Ubercart 2.
Now instead of linking the Product image in the Product site to itself or show it as a slideshow I would like to create a link to the URL of the given field.

I found the function that displays the product image, which is called 'theme_uc_product_image' and replaced

 $output .= '&lt;a href="'. imagecache_create_url('product_full', $first['filepath']) .'" title="'. $first['data']['title'] .'"';


with

$destination_url = $node-&gt;field_direct_shop_link[0]['url']; 
$output .= '&lt;a href="'. $destination_url .'" title="'. $first['data']['title'] .'"';


but it didn't work out!

Any ideas on how to solve this?

Thanks a lot in advance.
Best,
Manuel
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 = '&lt;div class="product-image"&gt;&lt;div class="main-product-image"&gt;';
  $output .= '&lt;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 .= '&gt;';
  $output .= theme('imagecache', 'product', $first['filepath'], $first['data']['alt'], $first['data']['title']);
  $output .= '&lt;/a&gt;&lt;/div&gt;&lt;div class="more-product-images"&gt;';
  foreach ($images as $thumbnail) {
    // Node preview adds extra values to $images that aren't files.
    if (!is_array($thumbnail) || empty($thumbnail['filepath'])) {
      continue;
    }
    $output .= '&lt;a href="'. imagecache_create_url('product_full', $thumbnail['filepath']) .'" title="'. $thumbnail['data']['title'] .'"';
    if ($image_widget) {
      $output .= $image_widget_func($rel_count);
    }
    $output .= '&gt;';
    $output .= theme('imagecache', 'uc_thumbnail', $thumbnail['filepath'], $thumbnail['data']['alt'], $thumbnail['data']['title']);
    $output .= '&lt;/a&gt;';
  }
  $output .= '&lt;/div&gt;&lt;/div&gt;';
  $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('&lt;pre&gt;' . print_r($images, TRUE) . '&lt;/pre&gt;');


at the start of your copied function.  Just remember to clear your caches/theme registry so drupal sees your function.