Posted Sun, 30 Oct 2005
I wrote a quick plugin this morning to generate links to related books (or other items) at Amazon.com using Amazon's Web Services (AWS), based on your entry's tags.
The plugin queries AWS's ItemSearch for each tag in an entry, and then sorts out the results in decreasing order of how many tags a product was returned in. Links are then generated using Amazon's product images for the top N results, where N is some configurable number of products. All the links are generated using your own Amazon Associates ID as well.
You can download it here
From the plugin documentation:
Uses your Amazon Web Services account to query products related to your Folksonomy Tags. This plugin does not require Folksonomy, however if you are using Folksonomy, please get the latest version of it, as there were some potential conlicts over the 'tags' metadata entry. Obtains a REST response from the following URL: http://webservices.amazon.com/onca/xml?Service=AWSECommerceService &AWSAccessKeyId=config['aws_access_key'] &AssociateTag=config['aws_associates_id'] &SearchIndex=config['aws_product_type'] &Operation=ItemSearch &Keywords=&Availability=Available &Merchant=Amazon [&Publisher=config['aws_favorite_pub']] Specify your AWS Access Key and the type of product to search for in your config.py, like so (defaults are as shown here): # Your AWS Access key py['aws_access_key']= # Your Amazon Associates ID py['aws_associates_id']= # The type of product to search on. py['aws_product_type']=Books # Restricts selections to a particular publisher py['aws_favorite_pub']= # The number of books to show on a page. py['story_product_count']=4 # The size of the amazon img to retrieve py['aws_image_size']="MediumImage"" aws_image_size can be one of: SmallImage MediumImage LargeImage I like to use MediumImage and then scale it down using CSS. The SmallImage returns a very low-res picture from Amazon, and is useful if you don't have a lot of bandwidth. aws_product_type and aws_favorite_pub can be overridden on a per-story basis by defining metadata with the same key name in your story. So for instance, if your config.py specifies an aws_product_type of "Books", but you just posted about DVDs, you could override this setting for your story by doing: My Post on DVDs #tags batman,superman,mighty mouse #aws_product_type DVD <p>DVDs are awesome.</p> Valid aws_product_type values are [ "Books","Music","DVD","Toys","Video Games","Software", "Software Video Games","Electronics","Tools", "Sporting Goods","Art Supplies","Kitchen","Gourmet Food", "Apparel","PC Hardware","VHS" ] aws_product_type defautls to "Books" Populates a varaible for use in your story template, that will contain HTML like: <div id="relatedproducts"> <a class="productlink" href="product url"> <img class="productimg" src="product img"/> </a> <a class="productlink" href="product url"> <img class="productimg" src="product img"/> </a> </div> If you do not want to generate related products for a particular entry, add a "noproducts" metadata entry: My Entry with No Products #noproducts





add to del.icio.us