0

How do I display a product's image given the nid?

1 Answer 1

1

It's tricky without some more information but something like this:

$product = node_load($nid);
$image_path = $product->field_image_cache[0]['filepath'];

print theme('imagecache', 'product', $image_path, $product->title, '');
2
  • So basically I just want to display the main image for a product when I have the product's nid.
    – kylex
    Commented Apr 6, 2012 at 19:38
  • If I remember right the above code should do that but I haven't used D6 in a while. Have you tried it?
    – Clive
    Commented Apr 6, 2012 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.