[ic] How to retrieve item options data in a perl block
New Media E.M.S.
ic_users at newmediaems.com
Wed May 5 12:48:44 EDT 2004
At 05:11 PM 5/5/2004 +0200, you wrote:
>New Media E.M.S. wrote:
>
> > At 11:40 AM 5/5/2004 +0200, you wrote:
> >
> > >Hi interchangers,
> > >
> > >this is IC 5.0* on FreeBSD with postgres.
> > >I have some items with simple options
> > >(new options: OptionsEnable option_type in etc/after.cfg).
> > >
> > >For further processing i would like to retrieve the selected
> > >item options data from basket. In IC i have:
> > >[item-list]
> > > [item-options type=value report=1]
> > >[/item-list]
> > >
> > >Now i don't now how to code this in a perl block / usertag.
> > >Currently a use a scratch variable, but this isn't elegant.
> > >
> > >The following doesn't work as expected:
> > >
> > >[calc]
> > >my $out;
> > >my $cart = $Carts->{main};
> > >my %options = (report => '1', type => 'value');
> > >my $opt = \%options;
> > >foreach my $item (@$cart) {
> > > $out .= $item->{code} ."-";
> > > $out .= $item->{quantity} ."-";
> > > $out .= $Tag->options( $item->{code},
> > > undef,
> > > $opt,
> > > $item, );
> > >
> > > $out .= "<br>";
> > >}
> > >return $out;
> > >[/calc]
> >
> > Did you try:
> >
> > $Tag->options( {
> > code => $item->{code},
> > type => 'value',
> > report => 1,
> > }
> > );
> >
> > - Ed
> >
>That outputs the optionnames without option values
>
>E.g:
>----------
>03-002-1-
>08-001-1-Schrift: , Text_1: , Bild: , Linie: , Farbe: , Text_2:
>-----------
> | | |
>sku | |
> quantity |
> |
> option names
>
>Achim :-(
Well, if you look in etc/report, the only parameter is report=1, so then
maybe you should try
$Tag->options( { code => $item->{code}, report => 1 } );
It's just a matter of finding the right parameters for what you want, you
may have to experiment at bit. That's how it goes with a system as complex
as Interchange.
- Ed
===============================================================
New Media E.M.S. Technology Solutions for Business
11630 Fair Oaks Blvd., #250 eCommerce | Consulting | Hosting
Fair Oaks, CA 95628 edl at newmediaems.com
(916) 961-0446 http://www.newmediaems.com
(866) 519-4680 Toll-Free (916) 961-0447 Fax
===============================================================
More information about the interchange-users
mailing list