public
Description: MIT licensed code without warranty ; )
Homepage: http://www.debuggable.com/
Clone URL: git://github.com/felixge/debuggable-scraps.git
debuggable-scraps / cakephp / datasources / amazon_associates

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