Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Need some help doing an if compare on price (MV4)



******    message to minivend-users from Hans-Joachim Leidinger <jojo@buchonline.net>     ******

Heinz Wittenbecher schrieb:
> 
> ******    message to minivend-users from "Heinz Wittenbecher" <heinz@bytedesigns.com>     ******
> 
> Thanks Ed.
> 
> I am using MV4. Should've mentioned it in original post.
> 
> Still stumped though.
> I have to compare value I would presume as the field would actually have a 0
> in it, even though I did try it with a blank field and still can't get it.
> 
> It can't be this difficult. Hopefully I'm just having an off day (days :-)
> 
> I'll keep trying ifs I guess, but if someone happens to have a working
> example it sure would be appreciated.
> 
> Heinz

To compare a real number and not a string, use [if blahblah == 0]. Or
use [if blahblah =~ /0/].

If the price in your products.asc is looking like "$ 123.00" or "123.00
DM" or whatsoever, you will always get "0". Test the calculation with
perl like

$a = "$ 123.00";
$b = "10";
$c = $a * $b;
print $c; ----> 0 or empty

but

$a = "123.00";
$b = "10";
$c = $a * $b;
print $c; ----> 1230.00

Another workaround is

[set name="dummy" interpolate][item-price noformat=1][/set]
[if scratch dummy > 0]
IS GREAT!
[else]
IS NOT GREAT!
[/else]
[/if]

or

[set name="dummy" interpolate][item-price noformat][/set]
[if scratch dummy == 0]
IS ZERO!
[else]
IS NOT ZERO!
[/else]
[/if]

or

[set name="dummy" interpolate][item-price noformat][/set]
[if scratch dummy =~ /0/]
IS ZERO!
[else]
IS NOT ZERO!
[/else]
[/if]



Regards,

	Joachim


-- 
-------------Hans-Joachim Leidinger---------------------

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: