MTAmazon 3.0 Template Tag Reference

How MTAmazon Template Tags Work

In previous versions of MTAmazon, new versions of the plugin had to be released every time Amazon upgraded their API. But with the latest version, MTAmazon was architected to be a more flexible framework for making Web Services calls to Amazon in order to display books, CDs, DVDs, or any item from Amazon's product catalog.

Here is how it works:

If MTAmazon supports a specific operation that Amazon exposes via a web service, then a Movable Type template tag is exposed with the same name. The current list of supported operations is:

  • ItemSearch
  • ItemLookup
  • SimilarityLookup
  • ListLookup
  • ListSearch

Each operation that Amazon exposes takes a number of different required and optional parameters as input. MTAmazon supports all of those parameters as template tag attributes using the same name. For example, let's look at the ItemSearch operation. According to Amazon's API documentation, ItemSearch requires that users specify the following parameters: TODO. Optionally, users can also specify these parameters: TODO.

So suppose I wanted display a list of 4 books on my blog that correspond with the keywords "Lord of the Rings"? To do so I would use the ItemSearch operation and the following search parameters: TODO. This would translate to the following template code:

<MTAmazonItemSearch Keywords="Lord of the Rings" 
                    ProductGroup="Books">
  <a href="<$MTAmazonDetailPageURL$>"><$MTAmazonTitle$></a>
</MTAmazonItemSearch>

The hope is that this is very straight forward and users can easily see how they can use Amazon's Developer Documentation, in combinition with this guide, to customize their exactly and how results from Amazon are displayed on their weblog.

Amazon API Quick Reference

Product Groups or Search Indexes

Here is a list of search indexes commonly used to find items on Amazon.

  • Books
  • Music
  • DVD
  • Toys
  • Video Games
  • Software
  • Software Video Games
  • Electronics
  • Tools
  • Sporting Goods
  • Art Supplies
  • Kitchen
  • Gourmet Food
  • Apparel
  • PC Hardware
  • VHS

Price Codes

You can often fetch prices or filter items by the offer type. Here they are:

  • New
  • Used
  • Collectible
  • Refurbished
  • All

Container Tags

These tags are the core of MTAmazon and correspond to the current set of Amazon Web Services operations supported by this plugin. Their usage is documented below.

<MTAmazonItemLookup>

The operation is used to display the details of a single item in Amazon's product catalog. Users provide the ID of an item using the ItemId attribute. If the item is found, then other template tags can be used to display details about that item. For example:

<MTAmazonItemLookup ItemId="B00005JNOG">
  <MTAmazonImageTag size="medium"><br />
  <a href="<$MTAmazonDetailPageURL$>"><$MTAmazonTitle$></a><br />
  Directors: <$MTAmazonItemAttributes name="Director"$>
</MTAmazonItemLookup>

Other attributes can be provided as input to this template tag, a complete list of which can be found at Amazon.

Here is a list of common input parameters:

  • ItemId
  • IdType
  • SearchIndex (e.g. Electronics, Music, Classical, DVD, VHS, Video, Software, VideoGames, etc)
  • MerchantId
  • Condition (e.g. New, Used, All, Refurbished, Collectible)
  • DeliveryMethod
  • OfferPage
  • ReviewPage
  • VariationPage
  • ResponseGroup

<MTAmazonItemSearch>

<MTAmazonItemSearch SearchIndex="DVD" Keywords="Star Wars" lastn="3">
  <p><MTAmazonImage size="medium"><br />
  <a href="<$MTAmazonDetailPageURL$>"><$MTAmazonTitle$></a><br />
  <MTAmazonIfItemAttribute name="Director">
    Directors: <$MTAmazonItemAttributes name="Director"$><br />
  </MTAmazonIfItemAttribute>
  Price: <$MTAmazonPrice$><br />
  </p>  
</MTAmazonItemSearch>

Other attributes can be provided as input to this template tag, a complete list of which can be found at Amazon.

Here is a list of common input parameters:

  • Availability
  • Keywords
  • Title
  • Power
  • BrowseNode
  • SearchIndex (e.g. Electronics, Music, Classical, DVD, VHS, Video, Software, VideoGames, etc)
  • Artist
  • Author
  • Actor
  • Director
  • MinimumPrice
  • MaximumPrice
  • MerchantId
  • Condition (e.g. New, Used, All, Refurbished, Collectible)
  • DeliveryMethod
  • ResponseGroup

<MTAmazonSimilarityLookup>

<MTAmazonSimilarityLookup ItemId="B00005JNOG" lastn="3">
  <p><MTAmazonImageTag size="medium"><br />
  <a href="<$MTAmazonDetailPageURL$>"><$MTAmazonTitle$></a><br />
  <MTAmazonIfItemAttribute name="Director">
    Directors: <$MTAmazonItemAttributes name="Director"$><br />
  </MTAmazonIfItemAttribute>
  Price: <$MTAmazonPrice$><br />
  </p>  
</MTAmazonSimilarityLookup>

Other attributes can be provided as input to this template tag, a complete list of which can be found at Amazon.

Here is a list of common input parameters:

  • SimilarityType (e.g. Intersection, Random)
  • Availability
  • ItemId
  • MerchantId
  • Condition (e.g. New, Used, All, Refurbished, Collectible)
  • DeliveryMethod
  • ResponseGroup

<MTAmazonListSearch>

<ul><MTAmazonListSearch Email="byrne@majordojo.com" lastn="3">
  <li><a href="<$MTAmazonListURL$>"><$MTAmazonListName$></a> - <$MTAmazonListType$></li>
</MTAmazonListSearch></ul>

Other attributes can be provided as input to this template tag, a complete list of which can be found at Amazon.

Here is a list of common input parameters:

  • ListType (e.g. WishList, WeddingRegistry, BabyRegistry)
  • Name
  • FirstName
  • LastName
  • Email
  • City
  • State
  • ListPage
  • ResponseGroup

<MTAmazonListLookup>

<MTAmazonListLookup ListId="WDYPAWENJVOW" lastn="3">
  <p><MTAmazonImageTag size="medium"><br />
  <a href="<$MTAmazonDetailPageURL$>"><$MTAmazonTitle$></a><br />
  <MTAmazonIfItemAttribute name="Director">
    Directors: <$MTAmazonItemAttributes name="Director"$><br />
  </MTAmazonIfItemAttribute>
  Price: <$MTAmazonPrice$><br />
  </p>  
</MTAmazonListLookup>

Other attributes can be provided as input to this template tag, a complete list of which can be found at Amazon.

Here is a list of common input parameters:

  • ListType (e.g. WishList, WeddingRegistry, BabyRegistry)
  • ListId
  • ProductPage
  • ProductGroup
  • Sort
  • MerchantId
  • ResponseGroup

Template Tags

The following template tags are used to access the data returned by Amazon. All of the following template tags must be used in conjunction with a container tag corresponding to an Amazon operation (e.g. ItemLookup, ItemSearch, etc.).

Item Tags

<$MTAmazonTitle$>

Returns the name of the item returned by Amazon.

<$MTAmazonDetailPageURL$>

Returns the URL to the page on Amazon's web site that contains more information about the item in question. The URL is encoded with your Amazon Associates ID so that you get rewarded when someone purchases a book or item you link to.

<$MTAmazonASIN$>

This is the unique Amazon identifier associated with the current item returned by Amazon.

<$MTAmazonProductGroup$>

The "product group" is synonymous with "category." Amazon surfaces a number of categories. Some of the most common categories are listed below:

  • Books
  • DVD
  • Music
  • Music Tracks
  • Video Games

<$MTAmazonItemAttributes$>

Amazon returns a lot of data associated with an item. The data returns depends entirely upon the type of object being returned. For example, MTAmazon returns an "Author" attribute for books, and a "Director" attribute for movies. The complete list of attributes that can be returned can be found in Amazon's Web Services API Documentation.

To use this element, one specifies the name of the attribute they would like to display the value for. For example, if one wished to display the name of the director associated with a movie, then you would use the following template tag:

<$MTAmazonItemAttributes name="Director"$>

Sometimes a movie has more than one directory, or a book has more than one author. In this case you may wish to display a list of attributes (or authors). To do so, one uses the glue attribute:

<$MTAmazonItemAttributes name="Author" glue=","$>

This will produce a list of authors separated by a comma.

<$MTAmazonImageTag$>

This returns a complete HTML tag referring the image associated with the current item. A user can optionally specify the size of the image they would like returned. The following values are allowed to be used in the size attribute:

  • thumb
  • small
  • medium
  • large

For example, the following template tag:

<$MTAmazonImageTag size="small"$>

Returns the following HTML:

<img src="URL" width="WIDTH" height="HEIGHT" alt="ITEM TITLE" />

<$MTAmazonCustomImageURL$>

Amazon has a robust system for transforming images in the catalog in a number of different ways. Through this mechanism users can:

  • blur an image
  • rotate an image
  • specify the exact width of an image
  • add a drop shadow to the image
  • and more

To make it easier to tweak images in these ways, the CustomImageURL tag was created. It accepts the following attributes:

  • size ::= small|medium|large|thumb
  • width ::=
  • blur ::= 0-100, where 0 is clear, and 100 is blurry as hell
  • rotate ::=
  • shadow ::= left|right, to display a drop shadow on the left and right side respectively
  • percent ::= 0-100, to display a "45% off" pill on the image
  • percent_loc ::= left|right to display the "percent off pill" in the lower left, or lower right hand corner respectively

<$MTAmazonPrice$>

This returns the price of the current item. Amazon of course sells multiple version of an item. One can buy an item used or new. To specify which price you would like to display on your weblog use the type attribute. Acceptable values are:

  • New
  • Used
  • Refurbished
  • Consult Amazon's Web services documentation for a complete list

For example:

<$MTAmazonPrice type="New"$>

The price that is returned is "formatted." In other words, it contains a currency character (like the dollar, pound, or euro sign), and the necessary decimals.

<$MTAmazonField$>

If Amazon returns data for which there is no corresponding template tag, this tag can be used to access it.

List Tags

<$MTAmazonListId$>

This returns the Id of the current list.

<$MTAmazonListURL$>

This returns the URL a user can visit to view the contents of the current list on Amazon's web site.

<$MTAmazonListName$>

The returns the name of the current list.

<$MTAmazonListType$>

The returns the type of the current list (e.g. WishList, ListMania, etc).

Conditional Tags

<MTAmazonIfItemAttribute>

This tag returns true if an attribute with the provided name exists. For example:

<MTAmazonIfItemAttribute name="Author">
   <$MTAmazonItemAttribute name="Author" glue=","$>
</MTAmazonIfItemAttribute>

9 Comments

There is a small bug with MTAmazonCustomImageURL: it does not respect locale!

For instance trying to get Fusion Frenzy 2 image (ASIN B000JMJUNC) I get this URL (which retrieves no image!):

http://images.amazon.com/images/P/B000WYXMMC.01.SCLZZZZZZZPC_.jpg

My locale is set to France. I should have this URL:

http://images.amazon.com/images/P/B000WYXMMC.08.SCLZZZZZZZPC_.jpg

Note: still a great plugin!

A small hint for those looking after MTAmazon32 syntax for attributes (the [attribute] one): MT4 allows usage of variables.

I store ASIN in the keywords. One could use this syntax:

A small hint for those looking after MTAmazon32 syntax for attributes (the [attribute] one): MT4 allows usage of variables.

I store ASIN in the keywords. One could use this syntax:

The outcome of the battle may well depend on the hope he can inspire, regardless of the odds. ,

I usually do not comment on blogs but thank you for your information. I enjoyed reading it.

Do you really expect us to believe that you really understand what you are talking about? My pet chihuahua knows more than you. Leave Britney alone!

I love your style, the notion that your site is a tiny bit unusual makes it so interesting, I get sick of finding the same same all of the time. This page is now stumbled

Superb thoughts on this page. It's unusual nowadays to get blogs with information you are looking for. I'm relieved I stumbled upon this post.

dont get me wrong this was a good post but somehow i feel something was missing, i do enjoy your writing style and think you could be more than good in the long run.

Leave a comment

what will you say?


Recent Comments

  • dont get me wrong this was a good post but somehow i feel something was missing, i do enjoy your writing style and think you could be more than good in the long run. ...

    timex ironman heart rate monitor
    MTAmazon 3.0 Template Tag Reference
  • Superb thoughts on this page. It's unusual nowadays to get blogs with information you are looking for. I'm relieved I stumbled upon this post. ...

  • I love your style, the notion that your site is a tiny bit unusual makes it so interesting, I get sick of finding the same same all of the time. This page is now stumbled ...

  • Do you really expect us to believe that you really understand what you are talking about? My pet chihuahua knows more than you. Leave Britney alone! ...

  • I usually do not comment on blogs but thank you for your information. I enjoyed reading it. ...

Close