Exemple #1
0
$items = $amazon_client->ItemSearch("Web Services Sanjiva", "Books");
foreach ($items->Item as $item) {
    echo $item->ASIN . ". ";
    echo $item->ItemAttributes->Title . " - ";
    #echo $item->DetailPageURL. " - ";
    echo $item->ItemAttributes->Author . "\n";
}
/************************************************************************/
/* Invoking the ItemLookup operation */
$lookups = $amazon_client->ItemLookup("0131488740");
echo $lookups->Item->ASIN . ". ";
echo $lookups->Item->ItemAttributes->Title . " - ";
echo $lookups->Item->ItemAttributes->Author . "\n";
/************************************************************************/
/* Invoking the CartCreate operation */
$cart = $amazon_client->CartCreate(array("0131488740" => 5));
echo $cart->CartId . " - ";
echo $cart->CartItems->SubTotal->FormattedPrice . "\n";
echo "HMAC: " . $cart->HMAC . "\n";
foreach ($cart->CartItems->CartItem as $item) {
    echo "Item: {$item->CartItemId} - {$item->Title}.\n";
}
echo $cart->PurchaseURL . "\n";
/************************************************************************/
/* Invoking the CartModify operation */
$cart = $amazon_client->CartModify("102-0208736-3675339", "lXOKkAyAVl6+/+D+KA3GvJRF4P0=", array("U181IPR3ATNL7R" => 3));
echo $cart->CartId . " - ";
echo $cart->CartItems->SubTotal->FormattedPrice . "\n";
echo $cart->PurchaseURL . "\n";
/************************************************************************/
/* Invoking the CartClear operation */
Exemple #2
0
    if ($item_lookups->Request != NULL && $item_lookups->Request->Errors != NULL && $item_lookups->Request->Errors->Error != NULL) {
        $error_message = trim($item_lookups->Request->Errors->Error->Message . "");
    } else {
        $item_lookups = $item_lookups->Items;
    }
}
/* When the adding is really happening */
$cart = $_SESSION["cart"];
$is_add_valid = "True";
if ($operation == "add") {
    $number = $_POST["number"];
    $key = $_SESSION["key"];
    if (!isset($cart) || empty($cart)) {
        /* we have to create a cart */
        $amazon_client = new AmazonClient($key, "SOAP");
        $cart_results = $amazon_client->CartCreate(array($asin => $number));
        $is_add_valid = $cart_results->Request->IsValid;
        if ($cart_results->Request != NULL && $cart_results->Request->Errors != NULL && $cart_results->Request->Errors->Error != NULL) {
            $error_message = trim($cart_results->Request->Errors->Error[0]->Message . "");
            $is_add_valid = "False";
        } else {
            if ($is_add_valid == "False") {
                $error_message = "The Item is not available to add to the cart";
            }
        }
        if ($is_add_valid == "True") {
            $cart = array();
            $cart["id"] = trim($cart_results->CartId[0]);
            $cart["HMAC"] = trim($cart_results->HMAC[0]);
            $cart["price"] = trim($cart_results->CartItems->SubTotal->FormattedPrice[0]);
            $cart["purchaseUrl"] = trim($cart_results->PurchaseURL[0]);