One of the things that’s bugged me for a while whilst having a website is that at certain times of the year when people might actually like to buy me a gift they’re unable to find my wishlist. This is mainly because they’re simple folk who might not think to check amazon for my name. I’m also signed up with amazon associates, so I decided it could do me well to post my wishlist items along with my referral tag in the links in order to earn a bob or two on my own homepage. All this data is available on the web already its just a case of putting it together.
Some keen readers might of noticed the wishlist page I stuck up recently and want something similar on their own site and (like myself) either can’t be bothered or didn’t have the time to create a plugin to pull this data together. I’m putting up here my own quick and dirty plugin I built a few weeks ago to achieve this.
It uses amazon web services to look up a wishlist, stick in a specified associates id in each of my item links and replace where I put the text (without spaces) in a post with my wishlist items. The plugin regularly updates this (hourly) as a scheduled event in wordpress in case someone decides to actually buy me something. Of course you’ll need a services key to use it, which you can easily get by signing up with amazon at aws.amazon.com. Fill out your services id, your wishlist id (found by logging into amazon and heading to your wishlist page) and your locale (the bit after amazon. so mine is .co.uk) and press the fetch items to pull all the items in. If you don’t have an associates id, feel free to leave as my own : )
I used curl to get the remote data from amazon as the file_get_content methods generally aren’t enabled on normal web hosts. If you’d like the items to be fetched less regularly, then install the plugin with and updated wp_schedule_event method in the main wishlist.php to a value of your choice.
You can download it over here.
Double alliteration in a post title? Not sure I’ve attempted that before.
[Edit: You'll need to be running on PHP5 to make use of this plugin]
Hey, you've reached the personal blog of Ian Wootten. Thanks for stopping by.
John
April 3rd, 2008 at 11:46 pm
Thanks Ian!
A useful plug-in at last for WP. There is something similar (or used to be) on Aaron Gustafsson’s website.
Cheers
John
Ian
April 3rd, 2008 at 11:52 pm
I’ve used a number of wishlist ones before but they all seemed to be a bit broken the last time I checked, especially when using associate ids and the like. I guess its Amazon changing the way queries are to be made that might contribute toward that.
PuReWebDev
April 23rd, 2008 at 11:56 pm
Thanks this sweet wishlist plugin. I do some development myself with their e-commerce api and even started messing around with probably the first ever Amazon Associates Video Podcast http://www.youtube.com/user/PuReWebDev
thanks,
PuReWebDev
Ian
April 24th, 2008 at 7:39 am
No probs. Glad you like it.
Nicole
May 30th, 2008 at 8:29 am
Hi, thanks for this great plugin! I changed the css of the output in wishlist_view.php a little bit into divs instead of tables. You can see how it looks like on my blog’s wishpage
<?php
foreach($items as $item)
{
$link = $wishlist_model->getItemLink($item);
$str.= “”.
“”.
“<a href=’”.$link.“‘ rel=”nofollow“>”.
“getItemImage($item).”‘/>”.
”</a>”.
”".
”<a href=’”.$link.” rel=“nofollow”>“.$item->title.”</a>“.
”".$item->author.
”".($item->price/100).” €“.
”";
}
?>
regards, nicole
Ian
May 30th, 2008 at 8:41 am
Hey Nicole, that’s a nice mod - thanks for sharing. I think I wanted something that would be really minimal to install, but would definitely go with a tableless option on my own site.
Nicole
May 30th, 2008 at 8:22 pm
Hi jan, I forgot to add: I’m really a replace-tables-by-divs-freak
So please don’t worry about the table - it’s fine to use tables in case of a quick hack. Thinking of the wishlist as a list of data you could even say that the wishlist is indeed worth a table.
I only changed it because I saw the table when I was looking for a hint in the code how to integrate the wishlist into my blog page. (I had searched in your correspondig post but I couldn’t figure it out and yes, I found the wordpress-wishlist-tag at the top of the view.php) And like I told you, I can’t resist changing tables into divs
However, the code in my previous post is destroyed and won’t work, so if anybody wants the css-table-free mod just mail me.
Thuy Lam
August 20th, 2008 at 8:48 am
Thanks for sharing.
Thomas
August 23rd, 2008 at 4:17 am
Very nice …
But all of my Amazon US items are all linking to the .co.uk site and turning up 404s when clicked.
Ian
August 23rd, 2008 at 9:55 pm
@Thomas, that’s correct - if you alter the locale to .com rather than .co.uk within the wishlist settings, that should remedy it.
unique design
October 10th, 2008 at 5:57 am
The theme is indeed very good,I am considering to change the theme of WP.
Bigger in Texas
October 22nd, 2008 at 4:43 pm
I wish my family would check my wishlist on Amazon. Then I wouldn’t have to return all the clothes they buy me.
Ian
October 25th, 2008 at 8:32 am
I take it this plugin is only compatible with Wordpress v2. I get the error “Fatal error: Call to undefined function: register_activation_hook()” when trying to activate it.
Ian
October 25th, 2008 at 9:20 am
@Ian I’ve not tested on anything less than v2, but v2+ is what I’m running on here. I’d imagine you’re right as it seems it was introduced in v2 in the official docs.
Ian
October 26th, 2008 at 8:26 am
It’s the second time today I’ve come across this problem. Although ‘Wordpress Automatic Upgrade’ is supposed to work with v1.5.2 it also fails on an undefined function (current_user_can) which was only introduced in v2.
Looks like I’ll have to follow the long-winded manual upgrade process.
Ian
October 26th, 2008 at 12:38 pm
OK, now fully upgraded (manually) to 2.6.3 (via 2.0.11 and 2.3.3)
I now get the error “Fatal error: Call to undefined function: simplexml_load_string()” when I try to fetch items.
Ian
October 26th, 2008 at 12:43 pm
Hey Ian, I’m taking a wild guess you’re not running PHP5 on your server. I should have put this in the requirements for the plugin. I’ve updated the post to reflect that.
Ian
October 26th, 2008 at 9:06 pm
yep, 4.4.2