felixge / debuggable-scraps

MIT licensed code without warranty ; )

This URL has Read+Write access

felixge (author)
Thu Mar 05 18:09:24 -0800 2009
commit  3fbfca1bd3205e78aac80414bb8e8556a40496ae
tree    c1401d9d8598bd57ec310b1b608d394606ccc2ed
parent  70ca21000c1309128ef9e5b63b704761dc619f7b
debuggable-scraps / cakephp / datasources / amazon_associates / readme.textile
100644 68 lines (53 sloc) 2.257 kb

CakePHP Amazon Associates Data Source

A CakePHP datasource for interacting with the amazon associates API. You can do cool stuff like finding images for Movies, Books and other products with it and then earn commisions on referals via Amazon’s associate program.

If you don’t have an amazon API key you can get one here: Get Amazon API key

Usage / Docs

Installing

1. Copy amazon_associates_source.php to app/models/datasources/
2. Open your app/config/database.php and add the following:


var $amazon = array(
	'datasource' => 'amazon_associates',
	'key' => 'your-amazon-key'
);

3. Create app/controllers/amazon_controlle.php with the following code:


class AmazonController extends AppController{
	var $uses = array();

	function index() {
		// Only needed if no Model has been loaded so far
		App::import('ConnectionManager');

		$amazon = ConnectionManager::getDataSource('amazon');
		$response = $amazon->find('DVD', array('title' => 'The Devil and Daniel Johnston'));
		debug($response);
		exit;
	}
}

4. Access the /amazon action of your app and look at the resultset.
5. Take a look at the available query options.

Missing Features

  • Implement missing operations (fork contributions welcome!):
    • BrowseNodeLookup
    • CartAdd
    • CartClear
    • CartCreate
    • CartGet
    • CartModify
    • CustomerContentLookup
    • CustomerContentSearch
    • Help
    • ItemLookup
    • ListLookup
    • ListSearch
    • SellerListingLookup
    • SellerListingSearch
    • SellerLookup
    • SimilarityLookup
    • TagLookup
    • TransactionLookup
  • Read associates tag from db config
  • Possibly other things, see Amazon API documentation

Known Bugs

None