[ic] modifying [item-quantity]

Mike Heins mikeh@minivend.com
Sat, 26 Aug 2000 14:30:00 -0400


Quoting Mathias Picker (mathiasp@venus.virtual-earth.de):
> First, a big thanks to the developers for a nice piece of software!
> 
> But it's a complex one, so one question:
> 
> How do I modify [item-quantity] in an [item-list]

You cannot, directly.

> 
> 
> Since I have limited stock, I need to stop users from ordering more
> items than I have.

There are a number of ways to do this. Here is one, placed at the top
of the basket and checkout page:

[perl tables=inventory]

	my $cart = $Carts->{main};
	my $item;
	foreach $item (@cart) {
	        my $on_hand = tag_data('inventory', 'quantity', $item->{code});
		next if $on_hand >= $item->{quantity};	<
		$item->{quantity} = $on_hand;
		$item->{q_message} = "Order quantity adjusted to fit stock.";
	}

[/perl]

Then you can place [item-modifier q_message] in the cart somewhere to
tell them when this happened.

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

I don't buy from direct telephone or email marketers.  This makes it
hard for me to find a phone company. ;>