Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Limit Quantity Solved



******    message to minivend-users from "Stan Crump" <stanc@amintech.com>     ******

That's outstanding, Kyle!  Thanks very much!
(It'll take me a while to absorp it and what a GREAT learning experience it
will be!)

   :  )

>

>******    message to minivend-users from "kyle@invisio.com"
<kyle@invisio.com>     ******
>
>What the heck, here is some code that may help.
>I have not tested it as I don't use the inventory db,
>but this should prevent orders for items beyond 
>qty on hand (and automatically set the max quantity
>for orders above the qty on hand).
>
>UserTag qty-limit Routine <<EOR
>sub {
> my $cart = $Vend::Items;
> my $item;
> my $message = '';
> my $itable = "inventory";
> my $qty_field = "qty";
> foreach $item (@$cart) {
>  $wish = $item->{'quantity'};
>  $have = Vend::Interpolate::tag_data($itable, $qty_field, $item->{code})
>|| '0';
>  if ($wish > $have) {
>   $item->{'quantity'} = $have;
>   $message .= "We only have $have on hand for item $item->{code}<br>";
>  }
> }
> $message .= "Ordered quantities have been adjusted." if $message;
> $Vend::Session->{qty-alert} = $message;
>    return '';
>}
>EOR
>
>put the tag [qty-limit] at the very top of your basket page
>then also in your basket page place the tag
>[data session qty-alert] to spit back any qty change
>messages that may have occured.
>
>At the worst, it won't work, at the best it takes care of the problem.
>
>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
>
>-
>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


Search for: Match: Format: Sort by: