[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] On the fly Item Deletion from Basket
The only way I've been able to alter the basket contents in my code is by
means of the [perl] tags, as in [perl arg="carts"]. This is explained in the
manual under 'Minivend Tag Reference - Embedded Perl Code.' You'll have to
understand (or be willing to grapple with) Perl arrays, references, and
hashes. Below I've pasted an example of how I've reset the quantity of an
item in the cart to 20:
[perl arg="carts"]
$new_quantity = 20;
# Loop over all items in the main cart:
foreach my $item ( @{$Safe{'carts'}->{'main'}} ) {
# Set quantity to the value of the variable $new_quantity
$item->{'quantity'} = $new_quantity;
}
return '';
[/perl]
I've been using a variation of this in my basket page to check the quantity
ordered (in the cart) with the amount available (in the inventory database)
and reduce orders if necessary.
What I would like to know is, how would I do something like this after the
order is submitted, but before it is processed. That way, each order would
have its quantities verified at the last second before the order is processed
and the inventory database is updated. Any ideas?
HTH,
Rob Maurer
In a message dated 11/20/99 1:35:06 AM Eastern Standard Time,
kswisher@iolinc.net writes:
> ****** message to minivend-users from kswisher@iolinc.net (Swisher,
Karl)
> ******
>
> Hello,
> Does anyone know of a line or two of code that would remove an item on
> the fly? I have already searched the Docs and Mail list archieve but my
> approach is different than the perl example given. I haven't used perl in
> the
> condition and selection statements. I have a products database in SQL. As
> best as I can tell, a product is removed from the basket in the basket
page
> form demo code and the perl example in this list's archieve by setting the
> quantity field in the basket to zero. I have tried many versions of this..
>
> [item-list]
> [if data database........
> [sql type=list.......
> [if ordered.........
>
> I am ready to remove the current item from the basket if it made it through
> all the previous condition and selection statements above. I have confirmed
> that items have met this criteria and made it here in my test store.
>
>
> All combinations of this and [item-quantity] with and without [calc] and
> scratch
> [calc][set mv_order_quantity]value=0[/set][/calc]
>
> [/if]
> [/sql]
> [/if]
>
> [/item-list]
>
> Any help will be appreciated. I'm using RH 5.2 and MiniVend 3.14-3
>
> Thanks
> Karl