[ic] Adding list of items to cart in perl code.

Kevin Walsh interchange-users@interchange.redhat.com
Mon Apr 22 16:17:01 2002


> > >
> > > I've checked through the list to find a simple example
> > > of adding a list of items into the cart using perl...to no avail.
> > >
> > > Basically, I have a hash of item and qty that I want
> > > dump into the cart and then show the basket.
> > >
> > > Any help would be appreciated.
> > >
> > How about something like this?
> >
> >     push @{$Carts->{main}},{
> >         code => '00-0010',
> >         quantity => 100,
> >     };
> >
> > Or this:
> >
> >     my %myhash =(
> >         code => '00-0010',
> >         quantity => 100,
> >     );
> >     push @{$Carts->{main}},\%myhash;
> >
> > Of course, both of those will ignore whatever "SeparateItems"
> > configuration you have specified.
> >
> The only problem I see is that the AutoModifiers are not getting picked up
> and put into the cart.  Is there a
> way to pick them up and toss them into the hash/cart
> also?
> 
I just showed you how to add items into the cart.  You said that you
already had a "hash of item and qty" so I assumed that you just needed
to know how to add this to the cart.

None of the catalog.cfg configuration directives, such as "AutoModifier",
"SeparateItems" etc. will be honoured by the above code as it bypasses
normal Interchange operation.  You can define whatever additional hash
keys/values you need before pushing the hashref onto the appropriate
cart array.

You may find the [dump] tag useful when determining which hash keys an
ordinary, Interchange-created, cart entry contains.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/