[ic] 3AM and no hair left to pull out..

Kevin Walsh interchange-users@icdevgroup.org
Sat Nov 23 07:48:00 2002


McTees [interchange@mctees.com] wrote:
> 
> Can anyone help shed some light on why this isn't working?
> Or is there some better way to do this? ( I am sure that there is a better way)
> 
> Everything works fine, till i want to check if the [subtotal] is >= to the 
> min_amount.
> 
> ------------------
> 
> [query sql="select comment, active, amount, percent, min_amount, code from 
> coupons where code = '[value ecoupon]'" type=list list=1]
>    [on_match]
>    	[if [sql-param active] > 0]
>     	      [if [subtotal noformat=1] >= [sql-param 
> min_amount]   <---   Having trouble here....
> 	           [if [sql-param percent] > 0]
> 	                ..do something..
>     	           [/if]
>     	           [if [sql-param amount] > 0]
> 		     ... do something ...	
> 	           [/if]
> 	       [else]
> 	             ,,, do something ...
>                   [/else]
> 	       [/if]
>            [else]
> 	    ... do something ...	
> 	[/else]
> 	[/if]
>     [/on_match]
>     [no_match][list][/list]
>         ... do something ...
>     [/no_match]
> [/query]
> 
The [if] section of the Interchange Tags Reference may help here. :-)
You could try:

    [if term="[subtotal noformat=1]" op=">=" compare="[sql-param min_amount]"]
        ...
    [/if]

You may also want to consider replacing the parts of your code that look
similar to this:

    [if [sql-param active] > 0]
        ...
    [/if]

with this:

    [if-sql-param active > 0]
        ...
    [/if-sql-param]

or simply "[if-sql-param active] ... [/if-sql-param]", if the "active"
column will never be < 0.  Same for your "percent" and "amount" columns
etc.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/