MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: A few questions...



Hi Trevor -

> Is there a way to reference all the attributes of the shopping cart
> items inside a [perl] construct?  I have seen reference various times to
> things like $Safe::Session and the like, but have avsolutely no
> understanding of how they work, and can find no help in the
> documentation. 

Here's some example code that might point you in the right direction:

[perl arg="carts"]

   # Loop over all items in cart:
   foreach my $item ( @{$Safe{'carts'}->{'main'}} ) {

      print "item code = " . $item->{'code'}     . "<br>\n";
      print "quantity  = " . $item->{'quantity'} . "<br>\n";

      # See if any modifiers:
      print "color = " . $item->{'color'} . "<br>\n"
         if exists $item->{'color'};
      print "size  = " . $item->{'size'}  . "<br>\n"
         if exists $item->{'size'};
   }

   # Add an item to the cart:
   #   Note: "mv_ib" is the product file in which the product exists
   push @{$Safe{'carts'}->{'main'}}, {
                                       'code'     => 'abc123',
                                       'quantity' => 3,
                                       'color'    => 'blue',
                                       'mv_ib'    => 'products',
                                     };
[/perl]


Larry Leszczynski
larryl@furph.com
--
  furph, Inc.	WWW/Unix/Windows Solutions	734-513-7763 (voice)
info@furph.com	   http://www.furph.com		734-513-7759 (FAX)



Search for: Match: Format: Sort by: