[ic] On the fly item quantity change?

Mike Heins mikeh@minivend.com
Wed, 13 Dec 2000 17:43:20 -0500

Quoting Jerry (jerry@digitalfm.com):
> Anyone now how, assuming it's possible, to change an
> item quantity, inside an item-list loop, via calculation
> and still get the item-subtotal correct?

Nope, because the price is calculated before the [item-calc] is
done. You have to change it in the cart itself first, then
do the loop to display the price.

	my $sku;
	foreach $sku (@$Vend::Items) {
	    delete $sku->{changed_it};
	    next unless $sku->{quantity} > 10;
	    $sku->{changed_it} = $sku->{quantity};
	    $sku->{quantity} = 10;

[if-item-modifier changed_it]
We changed your quantity from [item-modifier changed_it] to [item-quantity]
to fit what we have in stock. Sorry.

<INPUT TYPE=text NAME="[quantity-name]" VALUE="[item-quantity]" SIZE=3>

[item-quantity] is just shorthand for [item-modifier quantity], by the way.
As is [item-code] for [item-modifier code]. Try it. 8-)

Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Research is what I'm doing when I don't know what I'm doing.
-- Wernher Von Braun