WordPress Amazon Search Plugin [v1.0.1]
by Andy Maloney [imol00@gmail.com]
08 Jan 2008
Table of Contents
Description
Short description
Adds a search widget to allow searching of any international Amazon site and displays the results in your blog.
Longer description
This plugin provides an Amazon Search widget which will search any of the amazon servers
and produce search results with direct links to products.
The plugin allows you to set associate IDs for each international amazon server and set one of them
as the default for your site.
The plugin provides an XSLT file for the amazon server to access, which processes it together with the XML results of
the search, and then returns HTML. This saves your server from having to process the XML itself.
It uses css to format the search widget and the search results. It will look in its css dir for theme-specific css files
too, so if you have one in there called your-theme-name.css, it will include it after default.css. This way you can
customize it for a given theme by dropping in a new css file. So if you allow your users to switch themes, you can include
a css file for each one and the search will look correct when it is switched.
Why?
I originally wrote this for the Geeklog CMS. When I wrote it, Amazon did not provide widgets,
and Amazon Associates received more income for direct links than for others. So I wrote this so Associates could
generate more direct-link income from their sites.
Amazon now provides a widget that does most of this. What it doesn't do is integrate nicely with your website. This plugin
is intended to provide seamless integration with your site's theme and give you more control over the layout and information presented.
Keep in mind that although I am an experienced developer, this is my first venture into using and writing plugins
for WordPress. Please email me or post to the plugin page
if you have comments or suggestions on my code. I ported the Geeklog stuff almost directly
[except I changed a lot of the search results over to CSS for easier customization] and I'm sure there are
better ways to do what I'm doing. My main motivation to do this little project was to learn about WordPress...
If I get decent feedback and people are using it, I will continue to improve it.
Developed Using These Tools
- WordPress 2.3.3
- MAMP 1.7.1
- Firefox 2.0.0.12
- MacOS X 10.5.2
Limitations
The Amazon plugin currently has the following limitations:
- you cannot choose the sorting order
- you cannot choose which item data that is shown in the result [unless you know XSLT]
- it requires that your HTTP server have curl support
Version History
- v1.0.1 [22 Mar 2008]
- [new] add CSS for Silver Light theme
- [fix] fix incorrect paths due to last-minute name change
- v1.0.0 [08 Jan 2008]
Installing The Plugin
- Upload the whole amz-search directory to your /wp-content/plugins/ directory [it must be called amz-search]
- Activate the plugin through the 'Plugins' menu in WordPress
- Configure it using the Options -> Amazon Search page in WordPress
Configuring The Plugin
In the Admin section, under Options -> Amazon Search you may configure the following:
Associate IDs
In this section, fill in any associate IDs you have. You may also select one of the servers to be the
default for your users. If you live in France, you might choose the amazon.fr server, for example.
Any IDs left blank will be filled in with mine.
Development Contribution
Ah, here's the hook! I've set it up so that every 'N' searches, the links which are produced use my
associate IDs. You can choose a value for 'N' here. No need to go hacking if you don't want to support
development - just set it to 0 and it won't ever substitute my associate IDs.
Searching
The Default Category is the one that will be used when the user searches from the widget. When they
get the results, they will be able to change the category on the search page.
The Default Search Term is what is used if the user doesn't enter a search term. Right now it defaults
to 'WordPress'. You will probably want to change it to something appropriate to your site.
You may specify an XSLT file that will be sent to the amazon servers for processing. This file must be publicly
accessible because the amazon servers will be reading it to provide formatting.
If you don't know what this means, you better leave it alone. The XSLT file may be edited if you want to
customise the results produced by the search. I am certainly not an XSLT expert, so if you have any suggestions,
please contact me or post to the plugin page.
You may also set the size of the images that are to be returned in the search or 'None' to turn them off.
Watch out if you set this to 'Large'!
Things You Can Do
- Check my PHP & XSLT and tell me if there are better ways to do any of this.
- Let me know if you use it or have any suggestions - email me or post to the plugin page
- Link to my page [http://imol.gotdns.com] somewhere on yours.
- Use my Associate IDs for some of your searches [see Development Contribution above]
- Support development by making a donation:
or by using one of the following links to shop at amazon:
License
The WordPress Amazon Search Plugin is licensed under the GPL even though I don't really understand it and all its implications.
Why do we let legalese control the world?