[ic] Quantity of 1 Item Only

Dan Browning interchange-users@interchange.redhat.com
Mon Sep 17 20:42:01 2001


At 11:19 AM 9/16/2001 -0700, you wrote:
>How do I display the quantity of only 1 item in the cart?
>
>This is an example of what I need if it worked:
>
>[value item-quantity 2002]
>
>(2002 is sku/code #.)
>
>(I'm using IC 4.6.5)
>
>Thanks,
>
>Sydney Urshan
>p.s.  Please cc answer to urshan@nethollywood.net.

There may be an easier answer forthcoming, but you could iterate through 
the cart until you find the right sku, and then print the quantity, like so:

[calc]
         my $cart = $Carts->{main};
         my $this_sku = 0000001
         my $last_line_item = (@$cart - 1);
         my $count = 0;
         my $this_code;
         foreach (@$cart){
                 $this_code = $cart->[$count]{code};
                 if ($this_code eq $this_sku){
                         return $cart->[$count]{quantity};
                 }
                 $count++;
         }
         return;
[/calc]

HTH,

Dan Browning <danpb@mail.com>