[ic] flypage print problem

Peter peter at pajamian.dhs.org
Sun Jun 30 02:02:47 UTC 2013


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



More information about the interchange-users mailing list