[ic] perl syntax of shopping cart items

Dan Browning interchange-users@interchange.redhat.com
Thu Apr 11 17:47:00 2002


At 05:10 PM 4/11/2002 -0400, you wrote:
>I have a perl block on my checkout page and it needs to get the sku
>codes of the items in the shopping cart. I can do a dump() and see them
>buried deep down in some data structures. I've tried stuff like
>
>my @out = '';
>my %stuff = '';
>my $pop = '';
>my @input = @{$Carts->{main}};
>
>foreach %kip (@input) {
>   foreach $pop (%stuff) {
>     push (@out, $pop);
>   }
>}
>
>and I get closer but I don't know what I'm doing so the going is kind of
>slow. Does anyone know the perl syntax for getting at those code values?

         my $code;
         my $count;
         my $cart = $Carts->{main};
         foreach (@$cart){
                 $code = $cart->[$count++]{code};
         }
         return;

HTH,

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Dan Browning, Kavod Technologies <db@kavod.com>
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you think the United States has stood still, who built the largest
shopping center in the world?
                 -- Richard M. Nixon