Need someone to lead product or development at your software company? I lead product and engineering teams and I'm looking for my next opportunity. Check out my resume and get in touch.

MTAmazon 2.0

Freshness Warning
This article is over 18 years old. It's possible that the information you read below isn't current.

Note: MTAmazon now has its own site hosted at Source Forge. The most recent versions and documentation can be found there.

MTAmazon is a Movable Type plugin that uses your Amazon Associate membership to retrieve products from Amazon. It allows flexible searching and display of products from any of Amazon’s product categories.

The plugin uses Amazonís Web services toolkit to search for products by keyword, product category, artist, author, and more. Search results are cached for one hour to improve rebuilding performance on busy sites.

New in version 2.0 is the ability to automatically search for products related to your blog entries. You can use one of the special "related" keywords, or use the contents of any MT tag in your search.

Download. You can get MTAmazon by visiting the download page.

Requirements. In order to use MTAmazon, you’ll need to be running Movable Type 2.21 or later and have two Perl modules installed: XML::Simple and LWP::UserAgent. Both are common modules, so there’s a good chance your server has them installed.

When you rebuild your templates, MTAmazon will automatically check to see if these modules are installed on your server. If they aren’t already on your server, you can download and install them by copying them to Movable Type’s extlib directory.

To install LWP:UserAgent, please follow the instructions in the Movable Type documentation.

To install XML::Simple, download XMLModules.zip and unzip it. Upload the entire XML directory to your extlib directory inside Movable Type.

Installation. Once you’ve downloaded and unzipped MTAmazon.zip, connect to your FTP server and open the directory where you have Movable Type installed.

Create a directory there called plugins if there isn’t one already and copy amazon.pl to the plugins directory.

Create another directory inside your Movable Type directory called cache if there isnít one already. Set the permissions on this directory to 666. This is the directory where the cache files are stored. If you use a lot of different searches that change often, you may find that this directory ends up with a large number of files in it. If this concerns you, all of the files in the cache directory can be periodically deleted without causing any harm. MTAmazon will recreate any cache files it needs.

Using MTAmazon. Once you’ve installed MTAmazon, Youíll have a set of new Movable Type tags. Use these in your template to display products from Amazon.com.

Available tags.Any of the following tags can be used:

<MTAmazon >
<MTAmazon > is the container tag that executes a search returns the results. All other product-related tags must be placed within this container. MTAmazon accepts the following attributes:

  • related (Optional) Related can only be used if the MTAmazon tags are used on an individual archive or inside the <MTEntries> container. You can use any one of the following values for this attribute: category, title, extended, or excerpt. If this attribute is present, then the contents of the entry’s title, extended text, category, or excerpt will be is used as the search string.

  • search (Required unless related is used)
    The search keywords, ASIN, artist, or other search string to use. You can separate multiple search words with spaces. You can use the contents of any other MT tag as the search string by enclosing the other tag name in square brackets. For instance, to use an entryís title as the search string, you would use search="[MTEntryTitle]".

  • associateid (optional)
    The Amazon Associate ID to use. Using an Associate ID will allow Amazon.com to give you credit for any sales that you send their way. If you donít specify an Associate ID, Kalsey Consulting Groupís Associate ID will be used. You can set a default Associate ID by changing the line at the top of amazon.pl that reads my $default_associateid = "kalsey-20"; and replacing "Kalsey-20" with your associate ID.

  • devtoken (Required)
    The Amazon.com developer’s token. Amazon requires this token in order to track who is using their Web services. You can apply for one for free at http://amazon.com/webservices/. Youíll need to provide them with your name and address and accept a license agreement. You can set a default developerís token by changing the line at the top of amazon.pl that reads my $default_devtoken = ""; and place your developerís token inside the quotes.

  • method (optional)
    The search method to use. Defaults to Keyword. Valid values are: Keyword, Upc, Asin, Author, Director, Actor, Artist, Manufacturer, ListMania, Similar, BrowseNode, search, browse. You can find out more about search methods at http://amazon.com/webservices/. "browse" means the same thing as BrowseNode and "search" means the same thing as Keyword. These are included for backward compatibility with older versions of MTAmazon.

  • line (optional)
    The Amazon product line to search. Defaults to books. Valid product lines are:
    • baby (Baby)

    • books (Books)

    • classical (Classical Music)

    • dvd (DVD)

    • electronics (Electronics)

    • garden (Outdoor Living)

    • kitchen (Kitchen & Housewares)

    • magazines (Magazines)

    • music (Popular Music)

    • pc-hardware (Computers)

    • photo (Camera & Photo)

    • software (Software)

    • toys (Toys & Games)

    • universal (Tools & Hardware)

    • vhs (Video)

    • videogames (Computer & Video Games)

  • lastn (optional)
    The maximum products to retrieve. Defaults to 10. Valid values are the numbers 0-10.

<MTAmazonTitle >
The title or name of the product.

<MTAmazonASIN >
Amazonís product code for the product. This can be useful when setting up shoping cart links.

<MTAmazonCatalog >
The Amazon product category for the product.

<MTAmazonManufacturer >
The name of the product manufacturer or publisher.

<MTAmazonAuthor >
The name of a bookís author. If the product is not from the books line, this tag will contain nothing.

    Attributes:
  • glue (Optional)
    Some books have more than one author. You can use the glue attribute to specify what separator to use in the list of authors. Defaults to ", "

<MTAmazonArtist >
The name of the music artist. If the product is not from the music line, this tag will contain nothing.

    Attributes:
  • glue (Optional)
    Some music has more than one artist. You can use the glue attribute to specify what separator to use in the list of artists. Defaults to ", "

<MTAmazonImage >
This tag is being retired and is included for backward compatibility reasons. This returns the same image as <MTAmazonMediumImage >.

<MTAmazonSmallImage >
The small thumbnail image for the product.

<MTAmazonMediumImage >
The medium size image for the product.

<MTAmazonLargeImage >
The large image for the product.

<MTAmazonSalePrice >
Amazon’s price. If this is blank, it means that Amazon’s price is so low that it can’t be advertised. A shopper must actually add the product to their Amazon.com shopping cart before seeing it’s price.

<MTAmazonListPrice>
The manufacturer’s suggested, or list, price.

<MTAmazonUsedPrice>
The used price from Amazon Auctions and zShops.

<MTAmazonReleaseDate>
The date that the item was released. You can use MT’s date tag formatting to format this the way you would like. None of the dates include times, so if you use any time values in your formatting, the time is treated as 12:00 am. Some Amazon products do not have a day of the month included with the release date, so even if your date format specifies a day, it won’t be shown for those products.

<MTAmazonLink>
The URL of the product. This includes your affiliate code if you specified one in your search.

<MTAmazonCacheDateTime>
The date and time when the cache was last updated. If the cache is new, the current date and time are returned. You can use MT’s date tag formatting to format this the way you would like.

<MTAmazonField >
A special tag that returns the value of any field in the Amazon XML document. This can be used to support any additional fields that Amazon may add to their XML document without having to wait for another release of MTAmazon.

    Attributes:
  • name (Optional)
    The name of the Amazon XML field you would like to display.

<MTAmazonAssociateID >
The Amazon Associate id that was used in the search. This is primarily useful in constructing links to add items to an Amazon shopping cart or wish list.

<MTAmazonDevToken >
The Amazon developerís token that was used in the search. This is primarily useful in constructing links to add items to an Amazon shopping cart or wish list.

Example.

<MTAmazon method="Keyword" search="bowie" line="music" lastn="3">
<p><a href="<MTAmazonLink>">
<img src="<MTAmazonSmallImage>" align="left" border="0"><MTAmazonTitle>
</a><br>
<MTAmazonReleaseDate format="%B %e, %Y"><br>
Price: <MTAmazonSalePrice></p><br clear=all>
</MTAmazon>
Last updated: <MTAmazonCacheDateTime>

How to search There are many different Amazon product searches available to you. You can search using the methods Keyword, BrowseNode, Upc, Asin, Author, Director, Actor, Artist, Manufacturer, ListMania, or Similar. For each of these searches, you place your search terms in the MTAmazon search attribute.

Keyword. Keyword searches let you specify a list of search terms just as you would type them into the search box on Amazon.com. Multiple search words can be separated by spaces.

BrowseNode. BrowseNode allows you to return just about any list of products you see anywhere on Amazon.com. You can display best sellers, featured products, or all the products from one of their product categories. To use BrowseNode, you’ll need Amazon’s Browse ID for the category you which to display. To get the Browse ID, start browsing for products on Amazon. Once you’ve gotten to the category or product list you want to display, look in the address bar of your browser. You’ll see something like http://www.amazon.com/exec/obidos/tg/browse/-/408126/ref=br_dh_1_dah/002-8226029-7182418. The browse ID for this category (DVD Awards) is highlighted in bold. The portion you’ll need is the number after browse/-/.

Upc. UPC searches allow you to return a specific product or a list of products. Currently, Amazon.com only has UPC information for their music and classical categories, so using this type of search in any other category will return no results. If you want to find more than one UPC, you can separate the UPCs with commas.

Asin. An ASIN is Amazon.comís product number. By searching using Asin, you can get a list of specific products from Amazon. You can separate multiple ASINs with commas.

Author. Author searches let you retrieve a list of books by a certain author. Since only books have authors, using an author search on any other product line will return no results.

Director. Director searches allow you to retrieve a list of movies by a particular director. Director searches can only be performed on the dvd, vhs, and video product lines. Using another product line along with a director search will not return any products.

Actor. Actor searches allow you to retrieve a list of movies staring a particular actor or actress. Actor searches can only be performed on the dvd, vhs, and video product lines. Using another product line along with an actor search will not return any products.

Artist. Searching by artist will retrieve a list of products by an artist or musician. Artists only exist for music and classical categories, so using this type of search in any other category will return no results.

Manufacturer. This allows you to search for all products made by a particular company. Manufacturer searches only work for the electronics, kitchen, videogames, software, photo, and pc-hardware categories, so using this search in any other product line will return no results.

ListMania. ListMania lists are created by Amazon.com customers and usually appear on the right-hand side of the search results. These lists are usually lists of related products compiled by an Amazon.com customer, such as "Best Classic Horror Films" or "Favorite Childrenís Books."

To display a ListMania list on your site, youíll need the ListMania list id. Once you are on the page that contains the list you want to display, look in the address bar of your browser. You’ll see something like http://www.amazon.com/exec/obidos/tg/listmania/list-browse/-/2559R61E9FYYD/qid=1027657648/sr=5-2/ref=sr_5_2/104-6326920-4934352. The list ID for this list (Great Indoor Games) is highlighted in bold. The portion you’ll need is the number after list-browse/-/, 2559R61E9FYYD.

Similar. A popular Amazon.com feature is the "Customers who bought this also bought..." lists. To display a list of similar products for any particular product, all you need to do is use the Similar search method and the productís ASIN for the search string.

See it. Visit these sites to see MTAmazon in action:

Acknowledgements. Thanks to Brad Choate for contributing some of the code for MTAmazon. Also thanks to the many people who tested beta versions of the plugin and who used the first version and provided feature suggestions.

License. Like our other freeware, this plugin is released under the open-source MIT License. In plain English, that means you can do whatever you want with the software, including modifying it, selling it, or eating it, but we’re not responsible for anything that goes wrong.

Revision History
2.01 - July 26, 2002
(Fix) MTAmazonAuthor and MTAmazonArtists displays count instead of names
(Fix) MTAmazonReleaseDate displays 0000 for many release dates.

2.0 - July 25, 2002
(New) Support for the new Amazon web services format, including many new tags.
(New) Search results are cached for faster rebuilding.
(New) Related searches are allowed through a new related attribute.
(New) Search strings can be the contents of any Movable Type tag.

1.0 - July 14, 2002
Initial public release

Adriaan Tijsseling
August 4, 2002 5:40 AM

I'm getting the same error: Build error in template 'Main Index': Error in tag: Error in tag: close†go back MT::App::CMS=HASH(0x81eb094) print() on closed filehandle MT::CACHE at plugins/amazon.pl line 335. MT::App::CMS=HASH(0x81eb094) print() on closed filehandle MT::CACHE at plugins/amazon.pl line 335. MT::App::CMS=HASH(0x81eb094) print() on closed filehandle MT::CACHE at plugins/amazon.pl line 335. MT::App::CMS=HASH(0x81eb094) Use of uninitialized value in concatenation (.) at [..]/lib/MT/Builder.pm line 76. I have the cache in the right directory (directly under the MT dir). My template contains the following array: random amazon list " target="_top">, , " target="_top">, " target="_top">, , " target="_top">, , Can you help me out here?

Adriaan Tijsseling
August 4, 2002 5:50 AM

*sigh* I see all kinds of brackets were converted. Oh well, I fixed one thing: By setting the permissions of the cache to 776, I got rid of the "MT::App::CMS=HASH(0x81eb094) print() on closed filehandle MT::CACHE at plugins/amazon.pl line 335.", but I'm still getting the "MT::App::CMS=HASH(0x81eb094) Use of uninitialized value in concatenation (.) at [..]/lib/MT/Builder.pm line 76." error. I use a repetition of 4 tags, each with a different search string. I notice it is saved ok in the cache folder. (Btw, this did work well in the first version of MTAmazon.)

Adriaan Tijsseling
August 4, 2002 5:56 AM

My apologies! I didn't see that the newest version is hosted somewhere else. Version 2.0.2 solved my problem. So, please ignore or delete my previous comments.

Carla
August 8, 2002 5:59 AM

Could you please give some functional examples, with their output?

Adam Kalsey
August 9, 2002 9:32 AM

I've posted three sample templates along with the output they produce at http://kalsey.com/blog/2002/08/mtamazon_sample_templates.stm

Michael Bravo
May 28, 2003 3:53 PM

It is probably my faulty understanding of MT plugin functionality, but... is there a way to use MTAmazon tags in the text of posts, and not in the templates? Judging by the existence of text formatting plugins, it seems that processing of actual entry contents is possible...

Adam Kalsey
May 28, 2003 8:46 PM

MT does not process tags inside entry text. It doesn't even look to see if any are there. Text formatting plugins work differently. The MT engine passes the text through the foratting plugin before writing it to the page. The only way to get MT to process tags is through the use of my process tags plugin: http://kalsey.com/2002/08/process_tags_plugin/ Make sure you read the security concerns with the plugin at http://kalsey.com/2002/08/process_tags_security_update/

Michael Bravo
May 29, 2003 6:31 AM

Thanks! I really appreciate the advice and the effort gone into your plugins. By the way, there is a typo on the process_tags plugin page ( http://kalsey.com/2002/08/process_tags_plugin/ ), where it names process_plugins attribute instead of the correct (shown just below) process_tags. Perhaps this can deconfuse someone when fixed :)

Laura in DC
November 17, 2003 3:14 PM

Is there a similar tool for blogger?

Trackback from bloomfield.me.uk
January 3, 2004 3:26 PM

MTAmazon

Excerpt: I'm having a bit of a play around with the MTAmazon plugin....

Al
November 25, 2004 3:48 PM

Is 3.0 ever going to come out?

Trackback from What's New
February 24, 2005 8:40 PM

Reading List Fix

Excerpt: A massive thanks to heyblog for a most elegant MT-Amazon workaround that has finally allowed me to start updating my...

GC
June 14, 2005 4:50 AM

Hi ... trying to install MTAmazon for the first time and MT isn't picking up the plugin. I have BookQueueToo installed which appears in the plugin list fine. When I click on that plugin I get the error: "An error occurred: Your server does not have MTPlugins::MTAmazon installed, or MTPlugins::MTAmazon requires another module that is not installed. MTPlugins::MTAmazon is required. Please consult the installation instructions for help in installing MTPlugins::MTAmazon" XML::Simple (v2.14) and LWP::UserAgent (v2.001) are both installed. amazon.pl and .mtamazon.config are in the plugins folder and MTAmazon.pm is in the extlib folder. Am I missing something? Thanks. GC.

cm
July 6, 2005 9:38 AM

hi, would it be possible to use this plugin to get all the product reviews for a particular REVIEWER at amazon, not by product?

shine
March 31, 2009 8:12 AM

Can i know the "Suggested Tags from Similar Products" Xml FIeld Name for Amazon AWs API.

These are the last 15 comments. Read all 26 comments here.


Your comments:

Text only, no HTML. URLs will automatically be converted to links. Your email address is required, but it will not be displayed on the site.

Name:

Not your company or your SEO link. Comments without a real name will be deleted as spam.

Email: (not displayed)

If you don't feel comfortable giving me your real email address, don't expect me to feel comfortable publishing your comment.

Website (optional):

Recently Written

Software engineering manager interview questions (Aug 6)
Here are some questions I like to use to get a sense of who an engineering manager is and how they work.
A framework for onboarding new employees (May 15)
There’s no single good way to onboard an employee that works for every role. Here's a framework for creating a process that you can adapt to each situation.
TV hosts as a guide for software managers (May 10)
Software managers can learn a lot from journalists or late night TV hosts and how they interview people.
The Improvement Flywheel (Apr 29)
An incredible flywheel for the improvement of a development team. Fix a few things, and everything starts getting better.
Managers and technical ability (Dec 26)
In technical fields, the closer you are to the actual work being done, the closer your skills need to resemble those of the people doing the work.
Dysfunctions of output-oriented software teams (Sep 17)
Whatever you call it, the symptom is that you're measuring your progress by how much you build and deliver instead of measuring success by the amount of customer value you create.
Evaluative and generative product development (Aug 30)
Customers never even talk to the companies that don't fit their needs at all. If the only product ideas you're considering are those that meet the needs of your current customers, then you're only going to find new customers that look exactly like your current customers.
Product Manager Career Ladder (Aug 19)
What are the steps along the product management career path?

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2020 Adam Kalsey.