Dynamicweb.eCommerce.Prices Namespace > PriceManager Class > FindPrice Method : FindPrice(Product,Double,String,Currency) Method |
class MyPage : System.Web.UI.Page { private Dynamicweb.eCommerce.Products.Product product; private void Page_Load(System.Object sender, System.EventArgs e) { product = (Dynamicweb.eCommerce.Products.Product)Session["Ecom.Backend.Product"]; } private Dynamicweb.eCommerce.Prices.PriceInfo GetPrice(OrderLine orderlLine) { Dynamicweb.eCommerce.Prices.PriceInfo info = new Dynamicweb.eCommerce.Prices.PriceInfo(); info.Currency = Dynamicweb.eCommerce.Common.Context.Currency; if (orderlLine.BOMOrderLines.Count > 0) { if (product.PriceType == ProductPriceType.FixedPrice) { object priceObj = Dynamicweb.eCommerce.Prices.PriceManager.FindPrice(product, orderlLine.Quantity, orderlLine.ProductVariantID, Dynamicweb.eCommerce.Common.Context.Currency, orderlLine.UnitID); if (priceObj != null) { if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceInfo) { Dynamicweb.eCommerce.Prices.PriceInfo pi = (Dynamicweb.eCommerce.Prices.PriceInfo)priceObj; info = info.Add(pi); } else if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceRaw) { Dynamicweb.eCommerce.Prices.PriceRaw rp = (Dynamicweb.eCommerce.Prices.PriceRaw)priceObj; Dynamicweb.eCommerce.Prices.PriceCalculated cp = new Dynamicweb.eCommerce.Prices.PriceCalculated(product, rp); info = info.Add(cp); } } } else { //Adding only the BOM Orderlines info = info.Add(orderlLine.BOMOrderLines); } if (product.PriceType == ProductPriceType.CalculatedWithBase) { object priceObj = Dynamicweb.eCommerce.Prices.PriceManager.FindPrice(product, orderlLine.Quantity, orderlLine.ProductVariantID, Dynamicweb.eCommerce.Common.Context.Currency); if (priceObj != null) { if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceInfo) { Dynamicweb.eCommerce.Prices.PriceInfo pi = (Dynamicweb.eCommerce.Prices.PriceInfo)priceObj; info = info.Add(pi); } else if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceRaw) { Dynamicweb.eCommerce.Prices.PriceRaw rp = (Dynamicweb.eCommerce.Prices.PriceRaw)priceObj; Dynamicweb.eCommerce.Prices.PriceCalculated cp = new Dynamicweb.eCommerce.Prices.PriceCalculated(product, rp); info = info.Add(cp); } } } } else { object priceObj = Dynamicweb.eCommerce.Prices.PriceManager.FindPrice(product, orderlLine.Quantity, orderlLine.ProductVariantID, Dynamicweb.eCommerce.Common.Context.Currency, orderlLine.UnitID); if (priceObj != null) { if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceInfo) { Dynamicweb.eCommerce.Prices.PriceInfo pi = (Dynamicweb.eCommerce.Prices.PriceInfo)priceObj; info = info.Add(pi); } else if ((priceObj) is Dynamicweb.eCommerce.Prices.PriceRaw) { Dynamicweb.eCommerce.Prices.PriceRaw rp = (Dynamicweb.eCommerce.Prices.PriceRaw)priceObj; Dynamicweb.eCommerce.Prices.PriceCalculated cp = new Dynamicweb.eCommerce.Prices.PriceCalculated(product, rp); info = info.Add(cp); } } } return info; } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2