Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: users

flypage print problem

 

 

Interchange users RSS feed   Index | Next | Previous | View Threaded


kerry at basicq

Jun 29, 2013, 5:36 AM

Post #1 of 10 (86 views)
Permalink
flypage print problem

I am trying to print out the new shipping information based on a field
called width in the product table with the flypage.html.

[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]

I have tried different variations, but it has not worked. I guess I am
just not sure where to put the IC braces, or if you can even construct
it with ITT.

Kerry
Attachments: Attached Message Part (0.17 KB)


josh at perusion

Jun 29, 2013, 2:42 PM

Post #2 of 10 (80 views)
Permalink
Re: flypage print problem [In reply to]

Quoting kerry blalock (kerry [at] basicq):
> 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]

Not possible. Here's some documentation:
http://interchange.rtfm.info/icdocs/tags/if.html

You'll need to use "if explicit".

--
Josh Lavin
Perusion -- Expert Interchange Consulting http://www.perusion.com/

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

Jun 29, 2013, 5:09 PM

Post #3 of 10 (80 views)
Permalink
Re: flypage print problem [In reply to]

> I am trying to print out the new shipping information based on a field
> called width in the product table with the flypage.html.
>
> [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]
>
> I have tried different variations, but it has not worked. I guess I am
> just not sure where to put the IC braces, or if you can even construct
> it with ITT.
>
> Kerry

Can ITL be written with "and" in between two conditions like that?
I've never seen that before.

- Grant

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


emailgrant at gmail

Jun 29, 2013, 5:13 PM

Post #4 of 10 (80 views)
Permalink
Re: flypage print problem [In reply to]

> I am trying to print out the new shipping information based on a field
> called width in the product table with the flypage.html.
>
> [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]

How about:

[if-loop-data products width > 105]
[if-loop-data products width < 160]
[L]<span style="color: red; font-weight: bold;">Truck Shipping :
$85</span>[/L]
[/if-loop-data]
[/if-loop-data]

Of course, this needs to appear inside a loop.

- Grant

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


peter at pajamian

Jun 29, 2013, 6:43 PM

Post #5 of 10 (80 views)
Permalink
Re: flypage print problem [In reply to]

On 06/30/2013 09:42 AM, Josh Lavin wrote:
> Quoting kerry blalock (kerry [at] basicq):
>> 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]
>
> Not possible. Here's some documentation:
> http://interchange.rtfm.info/icdocs/tags/if.html

Yes, possible.

http://interchange.rtfm.info/icdocs/tags/if.html#and


Peter

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


peter at pajamian

Jun 29, 2013, 7:02 PM

Post #6 of 10 (80 views)
Permalink
Re: flypage print problem [In reply to]

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

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


kerry at basicq

Jun 30, 2013, 2:13 AM

Post #7 of 10 (78 views)
Permalink
Re: flypage print problem [In reply to]

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


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


kerry at basicq

Jun 30, 2013, 4:40 AM

Post #8 of 10 (78 views)
Permalink
Re: flypage print problem [In reply to]

On 06/30/2013 05:13 AM, kerry blalock wrote:
> [if data products::width::[item-code] > 105][and data
> > products::width::[item-code] < 160]
> > ...
> > [/if]
This looks like it works whit basic testing. Will run more test to be sure.

[if data products::width::[item-code] > 160] [L]<span
style="color : red;"><b>Truck Shipping : $170</b></span> [/L][/if]
[if data products::width::[item-code] > 105][and data
products::width::[item-code] < 160] [L]<span style="color :
red;"><b>Truck Shipping : $85</b></span> [/L]

[/if]

Kerry

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


peter at pajamian

Jun 30, 2013, 2:53 PM

Post #9 of 10 (78 views)
Permalink
Re: flypage print problem [In reply to]

On 06/30/2013 09:13 PM, kerry blalock wrote:
> 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.

It wasn't meant to be a complete solution but just to point you in the
right direction. You will need to modify to suit.

> I will
> try the ITL suggestions but am concerned on the resource usage you
> mentioned Peter.

Yes, the ITL will work, but you should always try to avoid fetching the
same data multiple times from the db on a single page, that's just plain
wasteful.


Peter

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


kerry at basicq

Jun 30, 2013, 3:44 PM

Post #10 of 10 (79 views)
Permalink
Re: flypage print problem [In reply to]

On 06/30/2013 05:53 PM, Peter wrote:
> On 06/30/2013 09:13 PM, kerry blalock wrote:
>> 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.
>
> It wasn't meant to be a complete solution but just to point you in the
> right direction. You will need to modify to suit.
>
>> I will
>> try the ITL suggestions but am concerned on the resource usage you
>> mentioned Peter.
>
> Yes, the ITL will work, but you should always try to avoid fetching
> the same data multiple times from the db on a single page, that's just
> plain wasteful.
>
>
> Peter
I realized it was pointer and intend to work with it some more to see if
I can find figure out how to implement it without major reconstruct of
the flypage. I am not strong in programing but am trying to improve on it.

Thanks for the input and help with a temporary fix. It is much better
than flagging each description of the items involved as that can become
a nightmare to upkeep down the road. At least it is in one file to
change when and if needed.

Kerry

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users

Interchange users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.