[ic] logic based on shipping weights

Stefan Hornburg interchange-users@icdevgroup.org
Tue May 6 06:10:00 2003


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