[ic] Discount Specifications

Peter peter at pajamian.dhs.org
Mon Nov 22 09:59:57 UTC 2010


On 22/11/10 19:49, Rick Bragg wrote:
> On Wed, 2010-11-17 at 09:16 -0800, Marty Tennison wrote:
>> Starting a new thread for discount specs....
>>
>> I just got done implementing this in our system so it's fresh in my mind.  If 
>> this is something anyone is interested in I'll be happy to elaborate and/or 
>> collaborate on the spec and share my experiences. 
>>
>> ================================================================
>>
>> Discounts have 3 major parts. 
>>   1) Discounts
>>   2) Rules
>>   3) Actions
>>
>>
>> DISCOUNTS:
>> Discounts have one or more rules.
>> Discounts have one or more actions.
>> Discounts can be active or inactive

Great idea

>> DISCOUNT_ACTIONS:
>> Actions have a type, operator and value
>> Action types are actually modules (subs) that can be plugged in as new actions 
>> are needed
>> Action types: (ideas)
>>   1) Percentage of subtotal
>>   2) Fixed amount
>>   3) Free Shipping
>>   4) Discount sku by fixed amount
>>   5) Discount sku by percentage
>>   6) Discount sku by (amt * qty)
>>   7) Display message
>>   8) Log something
>>   9) Deactivate discount (make discount a single use coupon)
>> Action Operator:
>>   1) (only used to enter SKU if needed for item 4,5,6 above)
>> Action Values:
>>   <user defined input>  ie: .65, 5 etc...

percentage and fixed amounts can be combined into a single action.  I
usually just use the % character at the end of the amount to
differentiate, and I do something like this to normalize it:

if ($amount =~ s/%$//) {
	$amount = $price * $amount / 100;
}

Of course there are also ways to make this infinitely more complex, with
sales such as, "buy two t-shirts (could be any of 50 distinct t-shirt
skus) and get a free cap", or even, "get this perfume set for only $10
with your order of $100 or more" (what do you do if the perfume set is
not in the cart, do you add it automatically, prompt the customer, or
discard the discount?), etc.


Peter




More information about the interchange-users mailing list