If you have full source code, the fix to resolve this issue can be made in the /Orders/OrderItemRepository.cs class file. Look for this code in the CreateForProduct() method:
Code: Select all
// CALCULATE THE PRICE OF THE PRODUCT
ProductCalculator pcalc = ProductCalculator.LoadForProduct(productId, quantity, optionList, kitList);
baseItem.Sku = pcalc.Sku;
baseItem.Price = pcalc.Price;
baseItem.Weight = pcalc.Weight;
// CHECK PRODUCT VARIANT
ProductVariant variant = productVarientRepo.LoadForOptionList(productId, optionList);
if (variant != null)
{
baseItem.OptionList = optionList;
baseItem.VariantName = variant.VariantName;
}
// CHECK FOR DIGITAL GOODS
Code: Select all
// CALCULATE THE PRICE OF THE PRODUCT
ProductCalculator pcalc = ProductCalculator.LoadForProduct(productId, quantity, optionList, kitList);
baseItem.Sku = pcalc.Sku;
baseItem.Price = pcalc.Price;
baseItem.Weight = pcalc.Weight;
// BEGIN MOD: AbleMods.com
// DATE: 08/26/2013
// BugFix: CostofGoods is never populated when directly building OrderItem object
// CHECK PRODUCT VARIANT
ProductVariant variant = productVarientRepo.LoadForOptionList(productId, optionList);
if (variant != null)
{
baseItem.OptionList = optionList;
baseItem.VariantName = variant.VariantName;
decimal? variantCOGS = variant.CostOfGoods;
if (variantCOGS != null && variantCOGS > 0)
{
baseItem.CostOfGoods = variantCOGS.Value;
}
}
// Set CostOfGoods to base product COGS if new OrderItem object CostofGoods is still zero
// In other words, only set it if a variant above hasn't already established as COGS value
if (baseItem.Product != null && baseItem.CostOfGoods == 0) baseItem.CostOfGoods = baseItem.Product.CostOfGoods;
// END MOD: AbleMods.com
// CHECK FOR DIGITAL GOODS