just thought this might be useful for some people (if you have a site for product reviews, for example):

1. for a CCK type, add a field and call it field_amazon.
2. enter the amazon product ID into field_amazon for each node, which can be found by using the amazon affiliate link search on amazon's affiliate advertising site.
3. create a new block, use PHP input filter, and put this in it, replacing YORUREFERRALID with your actual ID (which will also be shown when you are signed into amazon's affiliate/referral site (please keep in mind that the link they generate for you could be different, so compare a couple links to see how to format the long url string):

<center>
<iframe src="http://rcm.amazon.com/e/cm?t=YOURREFERRALID-20&o=1&p=8&l=as1&asins=
<?php
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$amazonvalue = $node->field_amazon[0]['value'];
print $amazonvalue;
?>
&fc1=000000&IS2=1&lt1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</center>

4. use php to have the block show up on only certain cck types.

basically you're printing the link amazon gives you for the ad in the block. first, the first half of the specific link they give you. then, using php, print the product id, which you will have to find and enter into the field_amazon for each node, and then print the second half of the link they give you.

-bill

Comments

wrb123’s picture

YOURREFERRALID-20 should actually be just YOURREFERRALID (without the -20... the -20 was part of my ID :)

this shows how important it is to use your own Amazon Affiliate URL and not mine from the post above, since it could change at any time.

Donovan’s picture

Thanks Bill! This looks like exactly what I am looking for.

Question: If something other than the amazon product id is entered in the field_amazon field (the book title, for example) will the function return a list of items matching the term(s) entered?

Thanks!

"It always seems impossible, until it is done."
- Nelson Mandela