com products by employing the techniques you
studied in the first part of the chapter. The new functionality isn??™t especially complex, but the possibilities are exciting.
To change the access method, modify the following in include/config.php:
// Amazon E-Commerce Service
define('AMAZON_METHOD', 'REST');
//define('AMAZON_METHOD', 'SOAP');
When Buy From Amazon links are clicked, Amazon.com associates that customer and the items purchased to your
associate ID (which is mentioned in the links). In the init() method from the AmazonProductsList class, the
GetProducts() method from the Amazon class is called to get the data to populate the list of products. This data
is read to build the Amazon.com links to the retrieved products:
CHAPTER 22 ?– USING AMAZON.COM WEB SERVICES 686
public function init()
{
$amazon = new Amazon();
$this->mProducts = $amazon->GetProducts();
for ($i = 0;$i < count($this->mProducts); $i++)
$this->mProducts[$i]['link'] =
'http://www.amazon.com/exec/obidos/ASIN/' .
$this->mProducts[$i]['asin'] .
'/ref=nosim/' . AMAZON_ASSOCIATES_ID;
}
However, you must know that Amazon.com offers many ways in which you can allow your visitors to buy its products.
If you log in to the Associates page, you??™ll see a number of link types you can build and integrate into your
web site.
Perhaps the most interesting and powerful is the possibility to create and manage Amazon.
Pages:
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801