コード例 #1
0
function showSmallCart()
{
    global $_SESSION;
    echo "<table border=\"1\" cellpadding=\"1\" cellspacing=\"0\">\n        <tr><td class=\"cartheading\">Your Cart \$" . number_format(cartPrice(), 2) . "</td></tr>\n       <tr><td class=\"cart\">" . cartContents() . "</td></tr>";
    // form to link to an Amazon.com shopping cart
    echo "<form method=\"POST\"\n              action=\"http://www.amazon.com/gp/aws/cart/add.html\">\n        <tr><td class=\"cartheading\"><a\n                href=\"index.php?action=showcart\"><img\n                src=\"images/details.gif\" border=\"0\"></a>";
    foreach ($_SESSION['cart'] as $ASIN => $product) {
        $quantity = $_SESSION['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        </td></tr>\n        </form>\n        </table>";
}
コード例 #2
0
ファイル: cartfunctions.php プロジェクト: kmfb21/A290CGI-PHP
function showSmallCart()
{
    global $_SESSION;
    echo '<table border = 1 cellpadding = 1 cellspacing = 0>';
    echo '<tr><td class = cartheading>Your Cart $' . number_format(cartPrice(), 2) . '</td></tr>';
    echo '<tr><td class = cart>' . cartContents() . '</td></tr>';
    // form to link to an Amazon.com shopping cart
    echo '<form method="POST" 
              action="http://www.amazon.com/o/dt/assoc/handle-buy-box">';
    echo '<tr><td class = cartheading><a href = 
                            "index.php?action=showcart"><img 
                            src="images/details.gif" border=0></a>';
    foreach ($_SESSION['cart'] as $ASIN => $product) {
        $quantity = $_SESSION['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 '</td></tr>';
    echo '</form>';
    echo '</table>';
}