protected void AddOrder() { CustomerInfo customer = createCustomer(); CountryInfo ci = CountryInfoProvider.GetCountryInfo(ECommerceSettings.DefaultCountryName(CMSContext.CurrentSiteName)); AddressInfo billing = new AddressInfo(); PaymentOptionInfo pi = PaymentOptionInfoProvider.GetPaymentOptionInfo("WorldPay", CMSContext.CurrentSiteName); OSI = OrderStatusInfoProvider.GetOrderStatusInfo("OrderCreated", CMSContext.CurrentSiteName); billing.AddressName = customer.CustomerFirstName + " " + customer.CustomerLastName; billing.AddressPersonalName = "Home"; billing.AddressCity = "";// TxtTown.Text.ToString(); billing.AddressIsBilling = true; billing.AddressIsShipping = true; billing.AddressLine1 = "";// TxtAddress1.Text.ToString(); billing.AddressLine2 = "";// TxtAddress2.Text.ToString(); billing.AddressZip = "";// TxtPostcode.Text.ToString(); billing.AddressCustomerID = customer.CustomerID; billing.AddressCountryID = ci.CountryID; billing.AddressEnabled = true; billing.AddressPersonalName = customer.CustomerLastName; billing.Insert(); ShoppingCart.ShoppingCartBillingAddressID = billing.AddressID; //Order // Set order culture ShoppingCart.ShoppingCartCulture = CMSContext.PreferredCultureCode; // Update customer preferences CustomerInfoProvider.SetCustomerPreferredSettings(ShoppingCart); // Create order ShoppingCartInfoProvider.SetOrder(ShoppingCart); order.SetValue("CustomerTitle", txtTitle.Text); order.OrderCustomerID = customer.CustomerID; order.OrderBillingAddressID = billing.AddressID; order.OrderShippingAddressID = billing.AddressID; order.OrderTotalTax = ShoppingCart.TotalTax; order.OrderTotalPrice = ShoppingCart.TotalItemsPrice; order.OrderTotalPriceInMainCurrency = ShoppingCart.TotalItemsPrice; order.OrderSiteID = CMSContext.CurrentSiteID; order.OrderStatusID = OSI.StatusID; order.OrderIsPaid = false; order.OrderCurrencyID = CMSContext.CurrentSite.SiteDefaultCurrencyID; order.OrderPaymentOptionID = pi.PaymentOptionID; order.SetValue("ImagePath", ViewState["PhotoPath"]); if (!corporate.Checked ) { order.SetValue("IsGiftAid", gift_aid.Checked); } else { gift_aid.Checked = false; } order.SetValue("AllowUseOfName", use_name.Checked); order.SetValue("AllowUseOfComment", use_comment.Checked); order.SetValue("Comment", userComment.InnerText); order.SetValue("CorporateDonation", corporate.Checked); OrderInfoProvider.SetOrderInfo(order); OrderItemInfo oii = OrderItemInfoProvider.GetOrderItemInfo(ShoppingCart.GetShoppingCartItem(ShoppingCart.CartItems[0].CartItemGUID)); oii.OrderItemOrderID = order.OrderID; OrderItemInfoProvider.SetOrderItemInfo(oii); }