[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Problems with discount formula
****** message to minivend-users from Mike Lerley <mike@bfent.com> ******
Will somebody please tell me why the following code, modeled after the
docs, does not work correctly:
[calc]
[item-list]
$totalq{"[item-field category]"} += [item-quantity];
[/item-list]
return '';
[/calc]
[discount ALL_ITEMS]
return $s if "[item-field category]" == "Cold Bay Seafood";
return 17*$q*5 if $totalq{"Hanson Bros."} >= 10;
return (27-$q)*5*$q;
[/discount]
Code is in basket.html. There are only two products in the database
with the "Cold bay seafood" category. They should not be discounted.
All other products, with a category of "Hanson Bros.",. start at
$26/pound in 5 pound increments and drop one dollar per pound for each 5
pounds purchased, with a minimum price of $17/pound. If I leave in the
first return line, no items are discounted. If I take it out, all
products are discounted including the Cold Bay ones (duh). Basically it
is returning $s whether the category is cold bay seafood or not. I have
verified that the category names are correct; the formula works
correctly if I take out the first return line.
While I'm on the subject, what exactly does the [item-discount] field
represent? It always ends up at something like $-230.00 for me and I
have no idea what it means. It doesn't seem to relate to anything..
something like $110 less than the previous selling price.. strange.
Thanks...
-mike
-
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