SVN URL: https://tfw.devguard.com/svn/os/plugins/mephisto_amazon/trunk/mephisto_amazon

Mephisto-Amazon lets you place Amazon content within Mephisto articles or layouts. You can search by each Amazon Standard Identification Number with an 'asin_search' or by keywords for different types of product with a 'keyword_search' or an Amazon 'wishlist_search' identifier.

If you are looking for a version of the plugin which works with Mephisto 0.7 or earlier,- try 1.0

Filters seem more helpful than tags, so I haven't added a wishlist tag. If someone needs it, let me know.

News

  • 19/1/2007 - In line for the next release of Mephisto, a new version (1.1) of Mephisto Amazon is available. You can configure the Amazon Dev Token and Associate Id through the Admin UI. I plan on adding configurable Locale quite soon (sorry GJones, am run off my feet).
  • A small bug, reported by Per (see comments below), has been fixed. The cache directory used by mephisto_amazon is generated and should be unique for each ruby process, in environments where many are running Mephisto Amazon.
  • The tests are currently broken in svn. I'll get round to fixing them soon. And I'll probably use this as an excuse to hook up pulse as a continuous integration server for Ruby.

Installing Mephisto-Amazon

script/plugin install https://tfw.devguard.com/svn/os/plugins/mephisto_amazon/trunk/mephisto_amazon



Wishlist Search

You'll need the 12 or 13 digit wishlist identifier. I found mine by looking at the Amazon URL. Remember to allow public access to your wishlist.

<filter:wishlist_search>1QFNGE30EZTX2</filter:wishlist_search>

renders as



ASIN Search

<filter:asin_search>0553214322</filter:asin_search>

or

{% asin_search 0553214322 %} {% endasin_search %}
renders as


The Island of Dr. Moreau (Bantam Classics)

Keyword Search

The first word is a 'search mode', anything following becomes a keyword in the search.

Search modes in ruby/amazon - apparel, baby, books, classical, dvd, electronics, garden, kitchen, magazines, music, pc-hardware photo, software, tools, toys, universal, vhs, video, videogames, wireless-phones.

<filter:keyword_search>books ruby programming</filter:keyword_search>

or

{% keyword_search books ruby programming %} {% endkeyword_search %}
renders as

Changing the Display

If you want to change the information displayed (larger images, more product information), check the liquid templates in the /views directory. Also, look at the ResponseDrop object to see the data available.

Pagination

Pagination seems limited. All tags and filters are returning the first page of results by default. When I have a moment I'll look at why it's problematic to handle many pages.

This plugin is really just a wrapper around the excellent ruby/amazon library, by Ian McDonald. See ruby/amazon . I recommend it if you want to integrate with Amazon.

11 Responses to “Mephisto-Amazon plugin”

  1. Nick Says:
    when I try using the {% asin_search books 0553214322 %} {% endasin_search %} tag in my layout... I get this in my production.log: ArgumentError (wrong number of arguments (2 for 3)): /vendor/plugins/liquid/lib/liquid/block.rb:23:in `initialize' /vendor/plugins/liquid/lib/liquid/block.rb:23:in `new' . . . any idea why this might be? I pasted the entire log entry on pastie... http://pastie.caboo.se/30812 I'd love to use the plugin. Any help would be appreciated. Thanks.
  2. Nick Says:
    Hey Nick, Sorry, the documentation was in error. asin_search only takes one parameter, the number and nothing else (as in the filter example). I'm changing it now. Cheers, Nick
  3. Per Says:
    I just tried out your plugin. It crashes due to a permission error: Amazon::Search::Cache::PathError (cache path /tmp/amazon is not writable): /vendor/plugins/mephisto_amazon/lib/amazon/search/cache.rb:39:in `initialize' The reason is that it defaults to using the absolute path "/tmp/amazon" as cache dir. That's a very bad idea - especially on a shared host. I assume it crashed since another user was also using your plugin and therefore currently owned that directory. I tried going through your code to see if you set a cache dir somewhere. But I couldn't find it. Instead I have hacked the above file so it always writes to a tmp dir in my home folder. But the best would be if you changed it to a local path - the tmp dir in the Mephisto root seems an obvious choice.
  4. Nick Says:
    Hi Piers, Yeh, it should be configurable. I haven't encountered it yet because I have my own machine. I'll have a look at it when I get a moment.
  5. Per Says:
    Sounds good. But my name is Per - not Piers... hehe. :)
  6. Nick Says:
    Per, sorry about that. What a bad misread!
  7. gjones Says:
    Is there an easy way to make it worth with UK ASINs? And produce links to the UK site? I had a quick look through the code, and noticed a bit that looked like locale detection, but I don't really understand Ruby very much... Also, although I'm in the UK, my server is in the US...if that's how the locale is determined, is there an easy way to over-ride it? While I'm at it, would it perhaps be an idea to add classnames to the generated HTML so that changes can be made without having to modify the plugin itself? I'm demanding, aren't I? Seriously though, I'm impressed with how easy it is to use, just a couple of little things that would make it absolutely awesome!
  8. Nick Says:
    Yes, the locale can be set, but I'll do this when I refactor Mephisto-Amazon to work with the new plugin feature in Mephisto - which lets you configure parameters within the plugin through the UI. Thanks for the positive feedback. Perhaps what you want done will be finished by the end of January? If it's bothering, send me an email and I'll show you the code which will let you set the locale.
  9. gjones Says:
    There's no particular hurry, I'm just playing around with the layout and things at the moment, trying to see what's possible. Noone's reading the things I write (aw!) yet, so where the links go isn't particularly important, and there were only 2 albums that had different ASINs in the US.
  10. Aubrey Says:
    Hi, I was trying to run this plugin against mephisto trunk and found a few problems, so I fixed them in my copy. If you're interested in a patch for it, send me an email... aubreyholland at gmail dot com.
  11. Thibaut Barrère Says:
    Hi folks, for those who may need it, I've released an adaptation of this plugin to use amazon-ecs (5.1) instead of ruby/amazon. The code is available here: http://code.google.com/p/logeek-labs/ cheers!

Leave a Reply