Filzhut.net Filzhut.net amazon_functions for PHP (Version 0.9)
Making the work with Amazon.com™ Web Services Version 1.0 much easier

amazon_create_cartform

Generates an HTML-Table to add a given ASIN to the amazon shopping-cart

amazon_create_cartform(string asin [, int form_type [, int image]])

This function returns a standarized HTML-form to add a product with an asin to the amazon™ shoppingcart, wishlist or wedding registry. The default form_type is CART to get an "Add to shopping cart" form. But you can also choose WEDDING for an "Add to wedding registry" form or WISHLIST for an "Add to wishlist" form. With image you can define that the returned form has no grey submit-button but the selected image instead.

Example 1. Returns a simple "Add to Cart" form:

$ShoppingCartForm=amazon_create_cartform("3182349567");
echo $ShoppingCartForm;

Will return:

<form method="POST" action="http://www.amazon.com/o/dt/assoc/handle-buy-box=3182349567/stores/detail/one-click-thank-you-confirm">
<input type="hidden" name="asin" value="3182349567">
<input type="hidden" name="asin.3182349567" value="1">
<input type="hidden" name="3182349567" value="1" size="1">
<input type="hidden" name="tag-value" value="leannrimesfansit">
<input type="hidden" name="dev-tag-value" value="D11PKT3GJ43H2X">
<input type="hidden" name="template-name" value="stores/detail/one-click-thank-you-confirm">
<input type="submit" name="submit.add-to-cart" value="Buy from Amazon.com">
</form>


Example 2. Returns a form with a graphical submit-button:

$ShoppingCartForm=amazon_create_cartform("3182349567",CART,"images/buynow.gif");
echo $ShoppingCartForm;

Will return:

<form method="POST" action="http://www.amazon.com/o/dt/assoc/handle-buy-box=3182349567/stores/detail/one-click-thank-you-confirm">
<input type="hidden" name="asin" value="3182349567">
<input type="hidden" name="asin.3182349567" value="1">
<input type="hidden" name="3182349567" value="1" size="1">
<input type="hidden" name="tag-value" value="leannrimesfansit">
<input type="hidden" name="dev-tag-value" value="D11PKT3GJ43H2X">
<input type="hidden" name="template-name" value="stores/detail/one-click-thank-you-confirm">
<input type="image" src="images/buynow.gif" name="submit.add-to-cart" value="Buy from Amazon.com">
</form>


© by Filzhut.net, Daniel Filzhut 2002