olefredrik / FoundationPress

FoundationPress is a WordPress starter theme based on Foundation 6 by Zurb
https://foundationpress.olefredrik.com
MIT License
2.71k stars 871 forks source link

Newbie question: Best way to integrate apai-io (amazon ad api library) #137

Closed dberz closed 9 years ago

dberz commented 9 years ago

(Big fan of this project - have used it successfully on a number of sites. Thank you!)

I'm new to web development and am trying to step up my game by creating a website that pulls product information from amazon into wordpress via the amazon advertising api. I've discovered the php library apai-io (http://exeu.github.io/apai-io/basic-usage.html) and it seems to be the best way to integrate amazon data into php sites.

MY QUESTION: what's the best way to call / integrate this library into the FoundationPress theme, without wrecking havoc on the default theme configurations and preventing future FoundationPress updates.

In other words, I've downloaded the library but need to 'load' it and want to know where to place the following call within the FoundationPress architecture. (Do I edit functions.php?)

use ApaiIO\Configuration\GenericConfiguration; use ApaiIO\Operations\Search; use ApaiIO\ApaiIO;

$conf = new GenericConfiguration(); $conf ->setCountry('com') ->setAccessKey('YOUR ACCESS KEY') ->setSecretKey('YOUR SECRET KEY') ->setAssociateTag('YOUR ASSOCIATE TAG');

$search = new Search(); $search->setCategory('DVD'); $search->setActor('Bruce Willis'); $search->setKeywords('Die Hard');

$apaiIo = new ApaiIO($conf); $response = $apaiIo->runOperation($search);

var_dump($response);

Also, any links to tutorials on utilizing webservices libraries similar to apai-io within Wordpress would be greatly appreciated. I'm just starting out here and the learning curve is daunting!

Thank you!

violacase commented 9 years ago

Integration of non-specific-related functionality should never be part of this or any other framework. I'd suggest to find or eventually write yourself a plugin to get what you need. See https://wordpress.org/plugins/search.php?q=amazon and http://codex.wordpress.org/Writing_a_Plugin Indeed: a steap learning curve if you're new to the world of WordPress. But what fun!