Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer

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, '');
share|improve this answer
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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