[ic] Discounts and coupon tracking?
Mike Heins
mike at perusion.com
Fri Jun 4 16:26:34 EDT 2004
Quoting Jonathan Clark (jonc at webmaint.com):
> What I can't do at the moment is apply conditions to a specific line in the
> cart. Lets say I have an item which is available with multiple options - the
> basic item (no options) I make virtually no money on and can't afford to
> discount, but some options I can afford the discount. There is no way of me
> doing an item discount through the discounts system to cover this. If my
> item is 12345 and I set up an item discount, I have access only to quantity
> and subtotal. It would be too complex to make a whole lot of other variables
> available to the discount sub, but I think the way forward might be to have
> a new type of discount:
>
> 'CART_ITEM_1' => 'return $s'
> 'CART_ITEM_2' => 'return $s * 0.9'
> etc.
>
> Obviously I would have to recreate this each time the cart changed though.
> Maybe a better way would be to allow the discount sub to use or have access
> to a modifier in the cart.
Wouldn't the standard mv_discount for the item work here?
[calc]
for my $it (@$Items) {
## Apply a discount randomly
if(rand(2) < 1) {
# Sorry bubba, no discount
$it->{mv_discount_message} = "No discount!";
delete $it->{mv_discount};
}
else {
# You lucked out!
$it->{mv_discount_message} = "You have a discount!";
$it->{mv_discount} = q{$s * .75};
}
}
return;
[/calc]
[item-list]
[if-item-param mv_discount]
[item-code] -- [item-param mv_discount_message]
-- Regular [item-subtotal]
-- Discounted [item-discount-subtotal]<br>
[else]
[item-code] -- [item-param mv_discount_message]
-- Regular [item-subtotal]
[/else]
[/if-item-param]<br>
[/item-list]
<br><br>
[total-cost]
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
For a successful technology, reality must take precedence over public
relations, for Nature cannot be fooled. -- Dick Feynman
More information about the interchange-users
mailing list