问题
I have made a PayPal form where I wish to sell multiple items and quantities (see screenshot). However when I use the code similar to the one written below I get a error if some of the items haven't been selected (quantity=0). The error says "A quantity value must be an integer greater than or equal to one." But I can't figure out how I could make the form behave like I want if I can't have some items with the quantity of 0.
Does anyone have a solution that fits my needs? I wouldn't like to have a "add to cart" button on every item.
Thanks!
<form>
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="myemail">
<input type="hidden" name="upload" value="">
<input type="hidden" name="item_name_1" value="First item">
<input type="hidden" name="amount_1" value="9">
<select name="quantity_1"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select>
<!-- more items -->
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
screenshot http://kejk.se/skar.png
回答1:
You would need to code in the logic not to send over items that have no quantities. The cart upload would only want to send over an item that has a quantity of atleast 1.
来源:https://stackoverflow.com/questions/15931241/paypal-choosing-multiple-items-with-quantities