Hi all,I've got an IC installation, 5.2 running on a RHEL4 WS server. The current catalog has the following snippet of code, curtosy of Mike Heins, to control the amount of items placed in the cart based on current inventory levels.
----------- CODE SNIPPET --------------
[comment]Adjust cart contents to match stock on hand[/comment]
[tmp outofstock][/tmp]
[perl tables="inventory"]
my $item;
foreach my $item ( @{$Carts->{main}} )
{
delete $item->{changed_qty};
if ($item->{quantity} > $Tag->data(inventory, quantity, $item->{code}) ) {
$item->{changed_qty} = $item->{quantity};
$item->{quantity} = $Tag->data(inventory, quantity, $item->{code});
}
if ($Tag->data(inventory, quantity, $item->{code}) <= 0 ) {
$Scratch->{outofstock} = "Sorry, item #$item->{code} is out of stock";
}
}
return;
[/perl]
[if scratch outofstock]
[scratch outofstock]
[tmp outofstock][/tmp]
[/if]
[if-item-modifier changed_qty]
Quantity changed from [item-modifier changed_qty] to [item-quantity] to
fit current inventory.
[/if-item-modifier]
---------------- end code snippet ---------------
This code works wonderfully, however, for some reason that I'm just not
seeing when the snippet does what its supposed to do and gets a positive
the message that is being displayed is the following:
[if-item-modifier changed_qty] Quantity changed from [item-modifier changed_qty] to [item-quantity] to fit current inventory. [/if-item-modifier]
Its actually only supposed to display this message: Quantity changed from <selected value> to <actual level value> to fit current inventory.Based on the code that I'm using on this basket code what am I missing that its outputting the entire if statement instead of just the message about the change being made along with the amount placed in the cart and the changed value?
This code snippet was placed at the very top of the basket.html page following the directions given in the following post:
http://www.icdevgroup.org/pipermail/interchange-users/2005-March/042433.html Thanks, -- Mark _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.