Grouper - Documentation
Reference: Functions | Plugins | Themes
Etc.: Configure | Affiliates
Amazon.com Affiliates Plugin
Affiliate RSS Feed
See a live demonstration of this plugin on an multi-affiliates search page.The Amazon.com plugin can be used by Amazon.com affiliates to search Amazon.com and convert the affiliates XML to RSS, with their affiliates IDs in the links. It works with a helper script, amazon2rss.php.
Installation:To use the Amazon.com plugin, xml-amazon.php, must be located in the "plugins" folder inside the folder containing grouper.php. This is the default location when Grouper Evolution is installed.
The helper script, amazon2rss.php, must be installed somewhere on your webserver where it is accessible by a web browser (though it won't actually be loaded directly by a web browser). Also, sha256.inc.php must be located in the same folder as amazon2rss.php.
Configuration:The most important configuration is performed by making changes to the "********* CONFIGURATION **********" section of amazon2rss.php. The necessary configuration changes should be clear from the notes appearing in that file. If you don't know your Amazon Access Key ID and Secret Access Key:
- Log into your Amazon affiliate account.
- Click "Product Advertising API" near the bottom of the menu on the left side of the page.
- Scroll down to the "Resources" section and click "Manage Your Account".
- In the "Access Identifiers" box, click "Click here".
- Your Access Key ID will be displayed automatically, but you'll need to click "Show" to display your Secret Access Key.
- Copy and paste those values into the indicated places in amazon2rss.php.
You may also make configuration changes to control which data from Amazon.com appears in the feed's description element. By default, it shows the list price, Amazon price, used price, average rating, and one review with its rating. Any or all of those pieces of data except for the Amazon price can be turned off, or the review summary may be displayed, by changing values in the array $xmlgrouperamazonconf after the Amazon plugin has been loaded.
For example, to turn off display of the used price, add this line of code to amazon2rss.php under the line that says "// if you want to turn off display of any data, add code to do that here":
$xmlgrouperamazonconf['show-used-price']=0;
The names of the available options and their default values are:
Option name | Default value |
show-list-price | 1 |
show-used-price | 1 |
show-avg-rating | 1 |
show-review-rating | 1 |
show-review-summary | 0 |
show-review-comment | 1 |
Use:
Once you have configured amazon2rss.php and uploaded it to your server, you may access the RSS feed generated by the Amazon.com plugin by entering the URL of amazon2rss.php into CaRP or whatever application you will be using to consume the feed, with your search terms added to the end of the URL like this:
http://example.com/amazon2rss.php?q=harry+potter
Notice how the space between "harry" and "potter" was changed to a plus sign. This is necessary because URLs cannot contain spaces.
By default, the Amazon.com plugin searches for books, unless you have changed the default category in amazon2rss.php. To search a different category, add it to the URL, like this:
http://example.com/amazon2rss.php?q=playstation&cat=Electronics
Check the Amazon.com associates documentation for a list of valid categories. Note that not all categories are available in all countries.