public virtual OrderCart CreateOrderCart(Models.OrderCart cart, string visitorId) { var c = new OrderCart(); c.AcceptCondition = false; c.AcceptConversion = false; c.AllowPartialDelivery = cart.AllowPartialDelivery; c.BillingAddress = null; c.CreationDate = DateTime.Now; c.DiscountTotal = cart.DiscountTotal; c.Message = cart.Message; c.ShippingFee = cart.ShippingFee; c.VisitorId = visitorId; c.ShippingFeeLocked = cart.ShippingFeeLocked; foreach (var item in cart.Items) { var i = new CartItem(); i.Packaging = item.Packaging; i.Product = item.Product; i.Quantity = item.Quantity; i.RecyclePrice = item.RecyclePrice; i.SalePrice = item.SalePrice; i.SaleUnitValue = item.SaleUnitValue; i.CreationDate = DateTime.Now; i.LastUpdate = DateTime.Now; i.Discount = item.Discount; i.CatalogPrice = item.CatalogPrice; i.AllowPartialDelivery = item.AllowPartialDelivery; i.IsLocked = item.IsLocked; i.PriceType = item.PriceType; i.ProductStockInfo = item.ProductStockInfo; c.Items.Add(i); } return c; }
public virtual void RecalcCartItem(CartItem item, int quantity) { if (item.IsLocked) { return; } item.Quantity = quantity; item.SalePrice = GetPriceByQuantity(item.Product, quantity, item.SalePrice); }
public Models.CartItem CreateCartItem() { var result = new CartItem(); // result.Id = Guid.NewGuid().ToString(); result.IsCustomerPriceApplied = false; result.CreationDate = DateTime.Now; result.LastUpdate = DateTime.Now; result.Discount = 0; result.PriceType = PriceType.Normal; result.ShippingType = ShippingType.WhenAvailable; result.AllowPartialDelivery = false; return result; }