Media Manager Template Tag Documentation
For the most part, Media Manager does not yet expose any template tags of its own. The only template tags exposes by this plugin are specifically for interfacing with Amazon's API.
AmazonItemSearch
AmazonItemSearch is a container tag and is responsible for conducting virtually all searches against Amazon's Marketing/Product API. Using this container tag you can search for Books, DVDs, or any product in their catalog, as well wishlists and more.
The arguments/attributes this template tag supports is drawn directly from the Net::Amazon. In fact, all of the search parameters supported by Net::Amazon's search() method are supported as attributed by this tag. This tag can be used to search for a specific item (e.g. by UPC or ASIN ID), or a group of items (e.g. by keyword or category).
For example, here are some of the search parameters supported by Net::Amazon (for a complete list please visit Net::Amazon's homepage).
asin
- Returns a single item identified by its ASIN (or Amazon ID).actor
- Return items starring an actor (or actress!). This is useful for video. Can return many results.artist
- Return items created by an artist. This is useful for music. Can return many results.author
- Search for items created by the specified author. This is useful for books obviously. Can return many results.browsenode
- Returns a list of items by category ID (node). For example node "4025" is the CGI books category. You can add a keywords parameter to filter the results by that keyword.exchange
- Returns an item offered by a third-party seller. The item is referenced by the so-called exchange ID.keyword
(orkeywords
) - Search by keyword, mandatory parameterskeyword
andmode
. Can return many results.wishlist
- Search for all items in a specified wishlist. Can return many results.upc
- Music search by UPC (product barcode), mandatory parameter upc.mode
has to be set to music. Returns at most one result.isbn
- Book search by ISBN (International Standard Book Number), mandatory parameter isbn. Returns at most one result. When searching non-US locales use the 13-digit ISBN.similar
- Search for all items similar to the one represented by the ASIN provided. Can return many results.blended
- Initiate a search for items in all categories.seller
- Start a search on items sold by a specific third-party seller, referenced by its ID (not seller name).mode
- The catalog by which to restrict your search. Common values are: Books, DVD, DigitalMusic, Merchants, VHS, and Video. A complete list can be found on Amazon's web site.
You can even combine the attributes to create compound searches. For example, to search for all books about "Blogging" you would use this tag:
<mt:AmazonItemSearch mode="book" keyword="blogging">
<mt:if name="__first__"><ul></mt:if>
<li><$mt:AmazonTitle$></li>
<mt:if name="__last__"></ul></mt:if>
</mt:AmazonItemSearch>
AmazonASIN
Return the ASIN of the current Amazon product or item in context. This must be contained by the AmazonItemSearch tag.
AmazonTitle
Return the title or product name of the current Amazon product or item in context. This must be contained by the AmazonItemSearch tag.
AmazonDetailPageURL
Return the URL to the product currently in context. This URL will contain your Amazon associates ID if you have specified one. This must be contained by the AmazonItemSearch tag.
AmazonProductGroup
Return the product group of the item currently in context. This must be contained by the AmazonItemSearch tag.
AmazonImageTag
This returns a complete HTML tag referring the image associated with the current item in context. 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:
<$mt:AmazonImageTag size="small"$>
Returns the following HTML:
<img src="URL" width="WIDTH" height="HEIGHT" alt="ITEM TITLE" />
AmazonCustomImageURL
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|thumbwidth
-blur
- 0-100, where 0 is clear, and 100 is blurry as hellrotate
-shadow
- left|right, to display a drop shadow on the left and right side respectivelypercent
- 0-100, to display a "45% off" pill on the imagepercent_loc
- left|right to display the "percent off pill" in the lower left, or lower right hand corner respectively
AmazonPrice
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:
<$mt:AmazonPrice 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.
AmazonItemProperty
This is one of the more powerful template tags provided by Media Manager for Amazon, as it provides direct access to any attribute or property that a product might have. The list of all of these properties is not listed here because it is an extensive list. The best place to look for these properties can be found at the Net::Amazon homepage. When you click through you will see a bunch of links to modules like:
- Net::Amazon::Property
- Net::Amazon::Property::Book
- Net::Amazon::Property::CE
- Net::Amazon::Property::DVD
- Net::Amazon::Property::Music
- Net::Amazon::Property::Software
- Net::Amazon::Property::VideoGames
These modules each document the list of properties associated with each product/media type. Let's look at an example. The media type of "Software" supports a property called "studio" which is meant to hold the name of the studio that produced the software. To output this property you could use the following code:
<mt:AmazonItemSearch asin="B00005JNOG">
<img src="<$mt:AmazonItemProperty property="ImageUrlMedium"$>" /><br />
<a href="<$mt:AmazonDetailPageURL$>"><$mt:AmazonTitle$></a> -
Studio: <$mt:AmazonItemProperty property="studio"$>
</mt:AmazonItemSearch>
Example Code
The following template tag sample code will show the last 4 Amazon items you added your system.
<mt:Assets type="amazon" lastn="4">
<mt:AssetsHeader>
<div class="sidebar-module pkg" style="width: 185px; clear: right;">
<h2 class="module-header">Currently</h2>
<div class="module-content">
<ul class="module-list"></mt:AssetsHeader>
<li class="item" style="float:left">
<a class="asset-image" href="<$mt:AssetURL$>">
<div style="height: 75px; width: 75px; padding: 5px; background-repeat: no-repeat; background-position: center center; background-image: url(<$mt:AssetThumbnailURL width="75"$>)"></div></a>
</li>
<mt:AssetsFooter></ul>
</div>
</div>
</mt:AssetsFooter>
</mt:Assets>
See the documentation for the "Assets" tag for more information.
Looks like AmazonCustomImageURL does not work... Did you mean AmazonImageURL?
Also I find the AmazonCustomImageURL a little bit curious. For instance ?, & and = are encoded as if they were parameters and not elements of the URL (please see http://www.zeguigui.com/catalogues/jeux-video/wii/mario-sonic-aux-jo-dhiver.php and the "buy" link).
I used the following tag in my template: ">plugins/MediaManager/images/buy-from-tan.gif" width="90" height="28" alt="" />
Thanks for upgrading MediaManager to the new Amazon API. Even if it broke some things the new version is far more powerfull (retreving ProductDescription is a great plus!)
A little question: does it work with MT5?
How do you handle AmazonItemProperty which return an array? For instance the authors property or tracks for music?
Tried to use but to no effect:
The code did not appear... <$mt:AmazonItemProperty property="e;tracks"e; setvar="e;audioTracks"e; $> <ol> <mt:Loop name="e;audioTracks"e;> <li><$mt:var name="e;value"e; encode_html="e;1"e; $></li> </mt:Loop> </ol>
Code (again, sorry for that!)
This was just what I was looking to use for a site I've created at http://www.dogspotty.com but I can't get it to work.
Has anyone else had any luck with this code?
thanks
Hey have you guys checked out Farmville Edge? If not you should, it's so nice, helped my farm soo much after all my crops just kept dying, gets me all my daily gifts in just one click, and the coolest secret items.
Amazon Web Services seriously borked both MediaManager and MTAmazon. AWS now needs a "signature", without which it returns an error. The signature involves parsing and sorting the REST command/request to AWS, and till that happens, neither plugin will work.