0

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

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
    Apr 6 '12 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
    Apr 6 '12 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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