[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] Limit Quantity Solved
****** message to minivend-users from "Stan Crump" <stanc@amintech.com> ******
Using Redhat 6.1 and MiniVend V3.14-3...
I'm working on a cart in which it is critical that customers not be allowed
to place an order for a quantity that is greater than the quantity on hand
for any item. I'm far from being a MiniVend expert and didn't know any PERL
at all until yesterday. Anyway, with EXCELLENT tips from Richard Russo and
"ZB", It's finally working and I just want to post the source for all the
group to use if ever needed...
(Please be sure to post any improvements that you're able to make.)
Thanks very much for the help, Richard and ZB!
In the "basket.html" page:
-- snip --
<select name=[quantity-name] value=[item-quantity]>
[perl interpolate=1]
$qvar = [item-quantity];
$ivar = [data inventory qty [item-code]];
for ( $mvar = 1; $mvar <= $ivar; $mvar++ ) {
if ($mvar != $qvar) {
$tmp .= "<option value=$mvar > $mvar\n";
}
else {
$tmp .= "<option value=$mvar SELECTED > $mvar\n";
}
}
return $tmp;
[/perl]
</select>
-- snip --
Stan Crump
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list