
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Quantity of 1 Item Only
Quoting Dan Browning (db@cyclonehq.dnsalias.net):
> 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]
The nitems tag does this in support of some pricing things:
[nitems qualifier=code compare="^the_sku$"]
where qualifier=attribute to check
compare =regular expression
This is even documented in ictags....
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Friends don't let friends use Outlook. -- Bob Blaylock
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users