[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] newbie: don't show price=0.00
At 02:58 PM 1/14/02, you wrote:
>I don't want to show the price on my flypage when [item-price]=0.00 (field
>price in the tabel products)
>
>I tried [if-item-data price = 0.00]Price :[item-price] [/if-item-data] but
>that doesn't work.
>How to do this ?
>
>Thanks for any help
A couple of notes:
Almost any place you want to check for numeric equivalency
be sure to use 2 equal signs like ==
The tag if-item-data or if-item-field or if-XXX-field etc will only check
that there is a "non-empty, non-zero " and 0.00 will be counted as a
true value because of the decimal point.
for example:
[loop
lr=1
list="
1 0
2 0.00
3 1.13
4 abcdef
5 "]
[loop-code]:
[if-loop-pos 1]
non zero, non blank: [loop-pos 1]
[else]
zero or blank: [loop-pos 1]
[/else]
[/if-loop-pos]
<br>
[/loop]
would produce:
1: zero or blank: 0
2: non zero, non blank 0.00
3: non zero, non blank 1.13
4: non zero, non blank abcdef
5: zero or blank:
So you need to do it differently maybe like:
[loop
lr=1
list="
1 0
2 0.00
3 1.13
4 abcdef
5 "]
[loop-code]:
[if term="[loop-pos 1]" op="==" compare="0"]
<b>this is numerically a zero</b> [loop-pos 1]
[else]
not a zero [loop-pos 1]
[/else]
[/if]
<br>
[/loop]
Which would produce:
1: this is numerically a zero 0
2: this is numerically a zero 0.00
3: not a zero 1.13
4: this is numerically a zero abcdef
5: this is numerically a zero
So the end result is you need to use the following to check for a zero in
the price field:
[if term="[item-price]" op="==" compare="0"]
This price is zero (or other text)
[else]
Price :[item-price]
[/else]
[/if]
OR if you don't need the else you could just do:
[if term="[item-price]" op=">" compare="0"]Price :[item-price][/if]
And nothing would display if price is zero (or negative :-)
Enjoy,
Kyle