[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Displaying Savings
****** message to minivend-users from "Russ" <russ@khouse.org> ******
Hello,
In an attempt to be similar to amazon.com in the good parts and different
than amazon on the bad parts I have written a couple of GlobalSubs to
display your savings on an item. I have a price field, and a retail field.
The retail field holds a higher value than the price field.
This sub returns your savings in the format of $4.99 ...
GlobalSub <<EndOfSub
sub you_save_dollars {
my($retail, $price) = @_;
my($yousave);
$yousave = $retail-$price;
currency($yousave);
return $yousave;
}
EndOfSub
Here's the minivend code in the page to return the value:
$[currency][perl arg=sub interpolate=1] you_save_dollars ([item-field
retail], [item-field price])[/perl][/currency]
This sub returns your savings in the format of 20% ...
GlobalSub <<EndOfSub
sub you_save_percent {
my($retail, $price) = @_;
my($yousave);
$yousave = (1-($price/$retail))*100;
$yousave = int($yousave);
$yousave .= "\%";
return $yousave;
}
EndOfSub
Here's the minivend code in the page to return the value:
([perl arg=sub interpolate=1] you_save_percent ([item-field retail],
[item-field price])[/perl])
I'm wondering if this can be added as a 'normal' minivend tag. something
that can be accessed with [item-you_save_dollars] and
[item-you_save_percent].
Any ideas? Mike, are you interested in having this in the features set?
Russ
--------------------------
Earn Money to surf the Internet Click Here!
http://www.alladvantage.com/refhome.asp?refid=AWW-495
-
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