// Products and Line Items public Orders.LineItem ConvertProductToLineItem(Orders.IPurchasable p, OptionSelectionList selections, int quantity, MerchantTribeApplication app) { Orders.LineItem li = new Orders.LineItem(); if (p != null) { Orders.PurchasableSnapshot snapshot = p.AsPurchasable(selections, app, true); if (snapshot != null) { li.BasePricePerItem = snapshot.BasePrice; li.ProductId = snapshot.ProductId; li.ProductName = snapshot.Name; li.ProductShippingHeight = snapshot.ShippingDetails.Height; li.ProductShippingLength = snapshot.ShippingDetails.Length; li.ProductShippingWeight = snapshot.ShippingDetails.Weight; li.ProductShippingWidth = snapshot.ShippingDetails.Width; li.ProductShortDescription = snapshot.Description; li.ProductSku = snapshot.Sku; li.Quantity = quantity; li.SelectionData = snapshot.SelectionData; li.ShippingSchedule = snapshot.ShippingDetails.ShippingScheduleId; li.VariantId = snapshot.VariantId; li.TaxSchedule = snapshot.TaxScheduleId; li.ShipFromAddress = snapshot.ShippingDetails.ShippingSourceAddress; li.ShipFromMode = snapshot.ShippingDetails.ShippingSource; li.ShipFromNotificationId = snapshot.ShippingDetails.ShippingSourceId; li.ShipSeparately = snapshot.ShippingDetails.ShipSeparately; li.ExtraShipCharge = snapshot.ShippingDetails.ExtraShipFee; } } return(li); }
public bool SaveProductToWishList(Orders.IPurchasable p, OptionSelectionList selections, int quantity, MerchantTribeApplication app) { WishListItem wi = new WishListItem(); if (p != null) { Orders.PurchasableSnapshot snapshot = p.AsPurchasable(selections, app, true); if (snapshot != null) { wi.ProductId = snapshot.ProductId; wi.Quantity = quantity; wi.SelectionData = snapshot.SelectionData; wi.CustomerId = app.CurrentCustomerId; } } return(WishListItems.Create(wi)); }