Clarification on the way how the distribution of "OrderLevelDiscount" works.

Vote:
 

Hi,

I am using EPi Commerce 7.5

I need some clarification on the way how the distribution of "OrderLevelDiscount" works.

I have seen that initially we will be deducting the lineitem level discount from the ordersubtotal and we will use the below formula to distribute the orderleveldiscount against the lineitem.

if (record.PromotionReward.AmountType == PromotionRewardAmountType.Percentage)
{
// calculate percentage adjusted by the running amount, so it will be a little less if running amount is less than total
percentageOffTotal = (record.PromotionReward.AmountOff / 100) * (totalAmount / record.AffectedEntriesSet.TotalCost);
//percentageOffTotal = PromotionReward.AmountOff / 100;
discountAmount = totalAmount * record.PromotionReward.AmountOff / 100;
}
else
{
// Calculate percentage off discount price
percentageOffTotal = record.PromotionReward.AmountOff / totalAmount;

// but since CostPerEntry is not an adjusted price, we need to take into account additional discounts already applied
percentageOffTotal = percentageOffTotal * (totalAmount / record.AffectedEntriesSet.TotalCost);

discountAmount = record.PromotionReward.AmountOff;
}

// Now distribute discount amount evenly over all entries taking into account running total
// Special case for shipments, we consider WholeOrder to be a shipment
if (!record.PromotionItem.DataRow.PromotionGroup.Equals(PromotionGroup.GetPromotionGroup(PromotionGroup.PromotionGroupKey.Shipping).Key, StringComparison.OrdinalIgnoreCase))
{
foreach (PromotionEntry entry in record.AffectedEntriesSet.Entries)
{
AddDiscountToLineItem(order, record, entry, 0, (((entry.CostPerEntry * entry.Quantity)/* - entry.Discount*/)) * percentageOffTotal);
}
}

The "totalAmount" here will be the subtotal after deducting lineitemdiscount.

For example we have 2 lineitems in our cart, subtotal is around 1200$.

Now after applying the lineitem discount(200$), order subtotal will be 1000$. This will become our "totalAmount" value in the above code.

Now if we have order level promotion with 10% discount.

I will be considered as

0.10 * (1000/1200) =0.0833

0.0833*quantity*extendedprice will be the orderleveldiscoutn against the lineitem right?

Can you please let me know if my understanding is correct?

Thanks,

Manjeera T

#182669
Sep 27, 2017 15:04
Vote:
 

The remaining cents should be evenly distributed across the line items and was fixed in a later version.  You can download the source code for the workflows and fix yourself if upgrading is not an option at the moment.

#183416
Oct 12, 2017 21:08
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.