I would like to conditionally display text on the search page. How can I do that?
(2003/08/08)I added the tokens %begin_if|expression|%...%end_if% and %begin_notif|expression|%...%end_notif% which will display their contents only if the expression evaluates to true. So, for example, if you wanted to pass a variable to the search page (perhaps by adding &Variable=1 to the url) and display text on the search page only if that variable (in this example, we'll call it Variable) was set to be equal to 1, then you could add this to your main template:
%begin_if|g.Variable EQ 1|%
This text displays only if the Variable is 1
%end_if%
Similarly, you can display text if the Variable is NOT 1 with:
%begin_notif|g.Variable EQ 1|%
This text displays only if the Variable is NOT 1
%end_notif%
of course this can also be done with the %begin_if| token:
%begin_if|NOT (g.Variable EQ 1)|%
This text displays only if the Variable is 1
%end_if%
A: I added this feature in a recent upgrade (version 4.88 compiled, 4.88 uncompiled). The %var| token will can now evaluate and display an expression or variable. For example, to display the price - cost for a product you would use a token of the sort:
%var|Products.d.price - Products.d.cost|%
With that upgrade I also modified the conditional tokens %begin_if| and %begin_notif| to be able to evaluate expressions. So if, for example, you wanted to display text only if the product has weight of 3, you could use:
%begin_if|Products.d.weight EQ 3|%
This product has a weight of 3!
%end_if%
Last update: 2005-01-12 08:49
Author: Support
Revision: 1.0
You cannot comment on this entry
Most Recent FAQ Entries: 
- I have the UPS Custom Integration configured so that ... (2008-07-11 10:21)
- I would like to conditionally display something for a ... (2008-07-03 17:37)
- Is there any way to configure specific global headers ... (2008-06-02 18:28)
- I pay my affiliates with gift certificates from your ... (2008-05-29 10:42)
- Is there any way to add a negative number ... (2008-05-22 13:51)
Top 10 
- 2521 views:
Adding Tokens to Evaluate Expressions - 2510 views:
Why won't you call me for technical support? I ... - 2489 views:
Is there a way to "Limit" the number of ... - 2402 views:
Are license keys valid for more than one store? ... - 2308 views:
I'm trying to enter a license key and get ... - 2270 views:
How do I install a module? - 2133 views:
How do I check for a module upgrade? - 2132 views:
How can display and change the parameters of an ... - 1960 views:
The total on my checkout pages are not correct. ... - 1843 views:
I have select and radio type attributes in my ...
















