[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
RE: Displaying Savings
****** message to minivend-users from "Thompson-Jordan" <Thompson-Jordan@mindspring.com> ******
I thought you could add some error checking and make it display nothing if
there is no discount. If you set the retail price to zero or it is the
same as the actual price it would show nothing. This way you could have
some things discounted and others not. If the retail price is higher than
the price it would show "You save $1.00" or "You save 10%". You could
change the text to suit you needs or modify the sub so that you could pass
the text with it.
Warning - I didn't test this code, I just typed in my ideas, so it would
need to be tested.
Christopher Thompson
> ****** message to minivend-users from "Russ"
> <russ@khouse.org> ******
GlobalSub <<EndOfSub
sub you_save_dollars_text {
my($retail, $price) = @_;
my($yousave);
if ($price < $retail) {
$yousave = $retail-$price;
currency($yousave);
$yousave = join ("You save ",$yousave);
return $yousave;
} else {
return ;
}
}
> 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_text {
my($retail, $price) = @_;
my($yousave);
if (($price > 0) && ($retail > 0) && ($price < $retail)) {
$yousave = (1-($price/$retail))*100;
$yousave = int($yousave);
$yousave = join ("You save ",$yousave,"\%");
return $yousave;
} else {
return ;
}
}
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
>
-
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