[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Limit Quantity Solved
****** message to minivend-users from "kyle@invisio.com" <kyle@invisio.com> ******
First, I'm not criticizing, just making some observations.
Second, thanks for contributing working code for others :-)
Now a couple of suggestions/observations:
1 your html select tag does not need or use the value= attribute
so you could just start with:
<select name=[quantity-name]>
2. Do you have/want a safeguard for high quantities (if applicable)
for example say you have in stock 200 of a certain item, if the original
code was run, the user would have a very long selection box.
This could be fixed by replaceing the "for" line with:
for ( $mvar = 1; ($mvar <= $ivar || $mvar > 50); $mvar++ ) {
just replace the 50 with the max amount you think anyone would
buy of any item you have, and that way it will never go beyond
this amount.
3. Do you have a safeguard in place to prevent 0 qty items
from appearing in the first place? IE if inventory for an item
is at 0 and the code below is run, you will get a selection box
with no entries in it that could confuse the visitor.
This could be fixed by putting all of the select html code
inside the perl and only display it if qty>0 else display
text like "Sorry this item is out of stock"
4. Another thing to watch out for is that the quantity in the inventory
is not decreased until after the sale so someone could click to add
the max (say 6) one time, then come back and still be able to click
6 again (on and on) because you are only checking at the time it
is added to the basket and not the actual basket contents.
Hope this helps,
Kyle (KC)
At 04:16 PM 2/8/00 -0600, you wrote:
>****** 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
-
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