I have the following code snippet:
// Creates a new order object and sets its properties
OrderInfo newOrder = new OrderInfo
{
OrderInvoiceNumber = StringUltils.RandomString(15, false),
OrderTotalPrice = product.SKUPrice - totalDiscount,
OrderGrandTotal = product.SKUPrice - totalDiscount,
OrderTotalTax = 0,
OrderDate = DateTime.Now,
OrderStatusID = orderStatus.StatusID,
OrderCustomerID = customerInfo.CustomerID,
OrderSiteID = SiteContext.CurrentSiteID,
OrderCurrencyID = currency.CurrencyID,
OrderGrandTotalInMainCurrency = product.SKUPrice - totalDiscount,
OrderCulture = currentUser.PreferredCultureCode
};
// Saves the order to the database
OrderInfoProvider.SetOrderInfo(newOrder);
// Creates a new order item object and sets its properties
OrderItemInfo newItem = new OrderItemInfo
{
OrderItemSKUName = product.SKUNumber,
OrderItemOrderID = newOrder.OrderID,
OrderItemSKUID = product.SKUID,
OrderItemUnitPrice = product.SKUPrice,
OrderItemUnitCount = 1,
OrderItemTotalPrice = product.SKUPrice - totalDiscount
};
// Saves the order item object to the database
OrderItemInfoProvider.SetOrderItemInfo(newItem);
But when this order saved to the Orders application. The total price of the order still is the original price. The total price just change to correct value when i click Update button in Items tab of the order. What am i wrong?