Under normal circumstances, the quantity value for a given item in your store can be any number at all. These tags can be used to place limits on the quantity value, allowing you to enforce rules like "Only one per customer".
<form name="demo" method=post action="!MYURL!"> <input type=hidden name="order_id" value="!ORDERID!"> <input type=hidden name="item_id" value="item_001"> <input type=hidden name="item_name" value="Widget 1"> <input type=hidden name="item_price" value="4.50"> <input type=hidden name="qty_min" value="2"> <input type=hidden name="qty_min" value="5"> <input type=text name="qty" value="0" size=4 maxlength=4> <input type=submit name="action" value="Order"> </form>
When adding new items to a shopping cart, Perlshop will check for the presense of qty_min and qty_max tags. If the item quantity falls outside the limits specified by these tags, the quantity will be altered so that the limits are respected. If the quantity falls below the specified minimum, Perlshop will set the item quantity to the specified minimum. If the quantity falls above the specified maximum, Perlshop will set the item quantity to the specified maximum. If either of these conditions occurs, an error message will be displayed above the shopping cart display that informs the customer of the adjusted quantity value.
Similar behavior will occur when using the quantity update button on the shopping cart display screen.
A special case exists for the quantity update button when the qty_min and qty_max values are set to the same value. In this case, the quantity value will be displayed without using a quantity box for that item. This is useful for situations in which a fixed quantity must be used for a given item.
<form name="demo" method=post action="!MYURL!"> <input type=hidden name="order_id" value="!ORDERID!"> <input type=hidden name="item_id" value="item_002"> <input type=hidden name="item_name" value="Widget 2"> <input type=hidden name="item_price" value="4.50"> <input type=hidden name="qty_max" value="10"> <input type=text name="qty" value="0" size=4 maxlength=4> <input type=submit name="action" value="Order"> </form>
This example shows a catalog item with an enforced lower quantity limit of 5:
<form name="demo" method=post action="!MYURL!"> <input type=hidden name="order_id" value="!ORDERID!"> <input type=hidden name="item_id" value="item_003"> <input type=hidden name="item_name" value="Widget 3"> <input type=hidden name="item_price" value="4.50"> <input type=hidden name="qty_min" value="5"> <input type=text name="qty" value="0" size=4 maxlength=4> <input type=submit name="action" value="Order"> </form>
This example shows a catalog item with an enforced quantity value of 1:
<form name="demo" method=post action="!MYURL!"> <input type=hidden name="order_id" value="!ORDERID!"> <input type=hidden name="item_id" value="item_003"> <input type=hidden name="item_name" value="Widget 3"> <input type=hidden name="item_price" value="4.50"> <input type=hidden name="qty_min" value="1"> <input type=hidden name="qty_max" value="1"> <input type=hidden name="qty" value="1"> <input type=submit name="action" value="Order"> </form>