[ic] flypage print problem

kerry blalock kerry at basicq.com
Sun Jun 30 09:13:15 UTC 2013


On 06/29/2013 10:02 PM, Peter wrote:
> First off, please do not start a new thread by replying to an existing
> one.
>
> On 06/30/2013 12:36 AM, kerry blalock wrote:
>> [if-item-data products width >160 ][L]<span style="color :
>> red;"><b>Truck Shipping : $170</b></span> [/L][/if-item-data], this
>> works fine, but when I try to condition the width between two sizes as
>> below, it does not print the info.
>>
>> [if-item-data products width >105 and if-item-data products width <160
>> ][L]<span style="color : red;"><b>Truck Shipping : $85</b></span>
>> [/L][/if-item-data]
>
> There is an [and] subtag to the [if] tag that will work:
> [if data products::width::[item-code] > 105][and data
> products::width::[item-code] < 160]
> ...
> [/if]
>
> ...alternatively, do this:
> [if data products::width::[item-code] > 160]
> ...
> [elsif data products::width::[item-code] > 105]
> ...
> [/if]
>
> That said, you're wasting a lot of DB resources here.  Each call to
> [data products width] performs yet another db query and it adds up
> quickly.  Also I've always found it to be rather in-efficient to put
> such detailed programming logic as ITL, you're much better off with a
> perl block:
>
> [perl products]
>     my $db = $Db{products};
>     my $width = $db->field(q{[item-code]}, 'width');
>     if ($width > 160) {
>         return q{Truck Shipping: $170};
>     }
>     elsif ($width > 105) {
>         return q{Truck Shipping: $85};
>     }
> [/perl]
>
> ...you get the idea.
>
>
> Peter
>

Thanks for the alternatives and suggestions. I have only tried Peter's
perl block and it works for printing the truck shipping but that is all
it prints about the item description as placed in the flypage. I will
try the ITL suggestions but am concerned on the resource usage you
mentioned Peter.

Kerry




More information about the interchange-users mailing list