Using MTAmazon in the UK

I use Adam Kalsey's MTAmazon V2.22 plugin for Movable Type to put Amazon product images at the top of blog entries (usually book reviews). I had to make a couple of changes to one of the source files to make it work with the UK version of Amazon's site.

[Updated 20041129 to link to a copy of the MTAmazon.pm file.]

Once you have installed MTAmazon per its instructions, the source file you will need to edit is MTAmazon.pm, which you will find in the .../MTPlugins directory.

You may or may not find that the distribution version of MTAmazon can be used to perform operations against the US version of the Amazon web site. It is worth doing this first to make sure that you have it working properly. If you get rebuild errors about files not existing, try making the following change to MTAmazon.pm:

368c368
<     my $url = "http://xml.amazon.com/onca/xml2?t=$associateid&" .
---
>     my $url = "http://xml.amazon.com/onca/xml3?t=$associateid&" .

This is just changing the version of the Amazon Web Services in use, which has changed (at least on some servers) since this version of MTAmazon was created.

When everything is working fine against Amazon.com, to convert to working against the UK site you need to edit MTAmazon.pm again, this time to switch the site from which the web services are requested:

368c368
<     my $url = "http://xml.amazon.com/onca/xml3?t=$associateid&" .
---
>     my $url = "http://xml-eu.amazon.com/onca/xml3?t=$associateid&" .

Note that this is a change to the same line in MTAmazon.pm.

In addition to the above, I make the following change:

371c371
<         "mode=$line&type=$format&page=$page&f=xml";
---
>         "mode=$line-uk&type=$format&page=$page&f=xml&locale=uk";

This change appends "-uk" to the mode parameter as well as adding an explicit locale setting. This was required when getting UK web services from the US site, but may now be superfluous. I regard it as tiger repellent for the moment. This change alone worked until 1-Oct-2003, when Amazon separated the European web services completely from the US ones.

Note that the forthcoming V3 of MTAmazon is claimed to have UK support built in, and will presumably not require these changes. However, I don't know when that is likely to be released.

You can get a copy of my modified version of MTAmazon.pm here.

Tags:

Comments

Ah. So that's why my images stopped appearing last month - they changed the URL. However, despite reinstalling MTAmazon and making both the changes you note above (I'd previously only changed the locale), I don't get a thing at the moment from the plugin.

I suspect that I'll wait for V3 now since much tinkering as yielded zero success. And there's always the mailing list...

Works perfectly for me. Thanks!

Thanks so much for this! I was wondering why my book list suddenly stopped working at the end of last year. Can't wait for V3 and then maybe I'll even be able to put both US and UK links on my page. :/ Until then, thanks so much!

Thanks so much for this code modification. I've been wracking my brain for days on UK compatibility - and now I've got it!

Thanks so much for the updated modification. You've saved mine (and my husband's) sanity!!!

I must admit that MTAmazon is causing me to go prematurely grey.

I tested the default build with amazon.com, all good, made the changes above, and it works, after a fashion. The URLs generated still point at amazon.com! Argh!

Any hints? (I've been testing at http://www.murky.org/testindex.shtml )

It's a shame though that even if working, MTAmazon doesn't *appear* to allow the plugin to be used from within posts, though that's more MT, I think, than MT Amazon (MT doesn't parse posts for tags).

Roll on V3! Any news? The pages look dead past May 2003.

Murky,

All I can suggest is that you check the list of changes again, very carefully. Sounds like you are perhaps querying the US servers rather than the EU ones?

On one of your other points, you might like to look into the Process Tags plug-in. I admit I haven't tried it myself, but it sounds like it might be what you are looking for if you want Amazon links within posts.

You wouldn't be able to email me a copy of the plug modified for the uk would you (i'm lazy)

Hi Emma,

I have uploaded a copy of the MTAmazon.pm file and linked to it from the end of the original article.

Thanks a lot for you help. Still not working, but I think its to do with my servers crappy perl install. Just need some time to look into it :)