[ic] logic based on shipping weights

Mark Bryant interchange-users@icdevgroup.org
Tue May 6 07:05:01 2003


At 11:08 06/05/2003, you wrote:
>On Tue, 06 May 2003 10:51:47 +0100
>Mark Bryant <mark@vwe.net> wrote:
>
> > Hi Folks,
> >
> > I'm trying to get a row printed into a table in the basket when the
> > shipping weight is over 10000. I'm using the following code, but I can't
> > see what's wrong with it.
> >
> > <table cellspacing="0" cellpadding="4" border="0">
> >    <tr>
> >      <td align=left class="contentbar1">Shipping Weight:</td>
> >      <td class="contentbar1" align="right">[summary total=1] grammes</td>
> >    </tr>
> > [perl]
> >    my $myout = '';
> >    if ([shipping total=1] > 10000) {
> >      $myout = "<tr><td colspan=2><small>Cart is too heavy for shipping. 
> Max
> > 10000 grammes.</small></td></tr>";
> >    }
> >    return $myout;
> > [/perl]
> > </table>
> >
> >
> > Everything seems to be OK until I hit my [perl][/perl] and then I get
> > things in the error.log for the catalog as follows:
> >
> > supercow.vwe.net 787S5Fhh:vwe.net - [06/May/2003:09:43:24 +0000] eros
> > /cgi-bin/eros/process.html Safe: Can't locate object method "shipping" via
> > package "total" (perhaps you forgot to load "total"?) at (eval 245) line 3.
> >  >
> >  >
> >  >   my $myout = '';
> >  >   if ([shipping total=1] > 10000) {
> >  >     $myout = "<tr><td colspan=2><small>Cart is too heavy for shipping.
> > Max 10000 grammes.</small></td></tr>";
> >  >   }
> >  >   return $myout;
> >  >
> >  >
> >
> > Does anyone know what I've done wrong here? The [shipping total=1] tag
> > seems to be working fine in the <TD> line above, so why isn't it 
> working in
> > the [perl][/perl] statement?
>
>Because Interchange doesn't interpolate the body of the [perl] tag.
>
>You can:
>
>* use [perl interpolate=1] (ugly and inefficient)
>* replace it with a Perl tag call $Tag->shipping({total => 1})
>
>Bye
>         Racke

Hi Racke,

I guess that one was pretty obvious and I should have know to try that, but 
thanks to you everything is working fine now.

Many thanks

Mark