[ic] Catalog subroutines

Dan Browning interchange-users@icdevgroup.org
Thu May 1 15:35:00 2003


At 01:48 PM 5/1/2003 -0500, you wrote:
>I'm trying to add a catalog subroutine according to the documentation in
>"26.94. Sub".  The example there a sort_cart_by_quantity function that
>builds a string and returns it.
>
>For practice I'm taking the foundation catalog and adding the number of
>items in the cart to the upper right hand section of the page.  Here's my
>function as listed in catalog.cfg:
>
>Sub <<EOF
>sub show_custom_cart {
> my $out = sprintf("%d item%s", scalar @{$Carts->{main}}, scalar
>@{$Carts->{main}} == 1 ? "" : "s");
> return $out;
>}
>EOF
>
>I call it like so:
>
>Your cart: [perl] return show_custom_cart(); [/perl]

[perl subs=1] ?

--
Dan Browning, Kavod Technologies, <db@kavod.com> 360.843.4074x217
6700 NE 162nd Ave, Ste 611-210, Vancouver, WA.      Random quote:
In Devon, Connecticut, it is unlawful to walk backwards after sunset.