Exemplo n.º 1
0
function showCart($cart, $mode)
{
    // build an array to pass
    $products = array();
    foreach ($cart as $ASIN => $product) {
        $ars = getARS('asin', array('asin' => $ASIN, 'mode' => $mode));
        if ($ars) {
            $products[] = $ars->getProduct(0);
        }
    }
    // build the form to link to an Amazon.com shopping cart
    echo '<form method="POST" 
              action="http://www.amazon.com/o/dt/assoc/handle-buy-box">';
    foreach ($cart as $ASIN => $product) {
        $quantity = $cart[$ASIN]['quantity'];
        echo "<input type='hidden' name='asin.{$ASIN}' value='{$quantity}'>";
    }
    echo '<input type="hidden" name="tag-value" value="ASSOCIATEID">';
    echo '<input type="hidden" name="tag_value" value="ASSOCIATEID">';
    echo '<input type="image" src="images/checkout.gif" 
                            name="submit.add-to-cart" 
                            value="Buy From Amazon.com">';
    echo ' When you have finished shopping press checkout to add all the 
         items in your Tahuayo cart to your Amazon cart and complete 
         your purchase.<br />';
    echo '</form>';
    echo '<a href = "index.php?action=emptycart"><img 
           src = "images/emptycart.gif" alt = "Empty Cart" border = 0></a> 
        If you have finished with this cart, you can empty it of all items.
        <br />';
    echo '<h1>Cart Contents</h1>';
    showSummary($products, 1, count($products), $mode, 0, true);
}
function showCart($cart, $mode)
{
    // build an array to pass
    $products = array();
    foreach ($cart as $ASIN => $product) {
        $ars = getARS('asin', array('asin' => $ASIN, 'mode' => $mode));
        if ($ars) {
            $products[] = $ars->getProduct(0);
        }
    }
    // build the form to link to an Amazon.com shopping cart
    echo "<form method=\"POST\"\n              action=\"http://www.amazon.com/gp/aws/cart/add.html\">";
    foreach ($cart as $ASIN => $product) {
        $quantity = $cart[$ASIN]['quantity'];
        echo "<input type=\"hidden\" name=\"ASIN." . $ASIN . "\"  value=\"" . $ASIN . "\">";
        echo "<input type=\"hidden\" name=\"Quantity." . $ASIN . "\" value=\"" . $quantity . "\">";
    }
    echo "<input type=\"hidden\" name=\"SubscriptionId\" value=\"" . DEVTAG . "\">\n        <input type=\"hidden\" name=\"AssociateTag\" value=\"" . ASSOCIATEID . "\">\n        <input type=\"image\" src=\"images/checkout.gif\"\n               name=\"submit.add-to-cart\" value=\"Buy From Amazon.com\">\n         When you have finished shopping press checkout to add all the\n         items in your Tahuayo cart to your Amazon cart and complete\n         your purchase.\n         </form>\n         <br/><a href=\"index.php?action=emptycart\"><img\n           src=\"images/emptycart.gif\" alt=\"Empty Cart\" border=\"0\"></a>\n        If you have finished with this cart, you can empty it of all items.\n        </form>\n        <br />\n        <h1>Cart Contents</h1>";
    showSummary($products, 1, count($products), $mode, 0, true);
}
Exemplo n.º 3
0
function similarSummary($ASIN, $mode)
{
    $ars = getARS('asin', array('asin' => $ASIN, 'mode' => $mode));
    if ($ars) {
        $product = $ars->getProduct(0);
    } else {
        echo "cannot get details for {$ASIN}";
    }
    if (!isset($product)) {
        return '';
    }
    $result = "<a href='index.php?action=detail&ASIN={$ASIN}'>" . $product->productName() . '</a> ';
    $result .= displayAuthors($product->authors());
    return $result;
}
function similarSummary($items, $mode)
{
    $ars = getARS('asin', array('asin' => $items['ASIN'], 'mode' => $mode));
    if ($ars) {
        $product = $ars->getProduct(0);
    } else {
        echo "<p>Cannot get details for " . $items['ASIN'] . "</p>";
    }
    if (!isset($product)) {
        return '';
    }
    $result = "<a href=\"index.php?action=detail&ASIN=" . $items['ASIN'] . "\">" . $items['Title'] . "</a> ";
    $result .= displayAuthors($product->authors());
    return $result;
}