Akopia Akopia Services

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

[mv] MV3.15 - discounts by category - SOLVED



******    message to minivend-users from "Russ Mann" <russrmann@hotmail.com>     ******

OK, i finally got it!
The trick is this:
[calc] variables are accessed through [discount], but [perl] variables are
not.  In order to use a variable started in a [perl] routine, it seems that
you have to make it a scratch variable, then make it a calc from the
scratch.  Then, after it is a calc variable, you can use it in your discount
routine.  Follow the "$discount_amount" variable through this routine to get
this.

"Audio Tapes" for the covertype is how i'm defining my category.  You could
use this: [calc]if ('[item-field category]' eq 'mycategory') { $totalbps +=
[item-quantity]; } [/calc], or someother variations.

<!--
[item-list]
[calc]if ('[item-field covertype]' eq 'Audio Tapes') { $totalbps +=
[item-quantity]; } [/calc]
[/item-list]
-->
[perl arg=scratch interpolate=1]
my $numoff;
my $totalbps = [calc]$totalbps[/calc];
if ($totalbps <= 2) { $numoff = 0; }
elsif (($totalbps >= 3) && ($totalbps <=9)) { $numoff = 1.96; }
elsif ($totalbps >= 10) { $numoff = 2.46; }
$discount_amount = $totalbps * $numoff;
$Safe{'scratch'}->{'discount_amount'} = $discount_amount;
return '';
[/perl]
<!--[calc]$discount_amount += [scratch discount_amount][/calc]-->
[discount ENTIRE_ORDER]
return ($s-$discount_amount);
[/discount]


Quantity of Briefing Packages: [calc]$totalbps[/calc]<br>
Briefing Package Quantity Discount: [currency][scratch
discount_amount][/currency]<br>

Thanks for all your help!

Russ
-
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: