/// <summary> /// Generate the different type of price information for the product /// </summary> /// <param name="price"> /// User specific price information based on the chosen option for the product on the product detail /// page /// </param> public ProductPrices(UserSpecificPrice price) { if (price.ListPriceGreaterThanCurrentPrice) { ListPrice = new PriceData { Label = GlobalLocalization.GetString("ListPrice"), Text = price.ListPrice.ToString("C"), RawValue = price.ListPrice.ToString("F") }; } SitePrice = new PriceData { Label = GlobalLocalization.GetString("SitePrice"), Text = price.DisplayPrice(true, false), RawValue = price.DisplayPrice(true, false) }; if (price.BasePrice < price.ListPrice && price.OverrideText.Trim().Length < 1) { YouSave = new PriceData { Label = GlobalLocalization.GetString("YouSave"), Text = string.Format("{0} - {1}{2}", price.Savings.ToString("c"), price.SavingsPercent, Thread.CurrentThread.CurrentUICulture.NumberFormat.PercentSymbol), RawValue = price.SavingsPercent.ToString("N") }; } }
private void RenderPrices(ProductPageViewModel model) { string userId = MTApp.CurrentCustomerId; StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"prices\">"); UserSpecificPrice productDisplay = MTApp.PriceProduct(model.LocalProduct, MTApp.CurrentCustomer, null, MTApp.CurrentlyActiveSales); if (productDisplay.ListPriceGreaterThanCurrentPrice) { sb.Append("<label>" + SiteTerms.GetTerm(SiteTermIds.ListPrice) + "</label>"); sb.Append("<span class=\"choice\"><strike>"); sb.Append(model.LocalProduct.ListPrice.ToString("C")); sb.Append("</strike></span>"); } sb.Append("<label>" + SiteTerms.GetTerm(SiteTermIds.SitePrice) + "</label>"); sb.Append("<span class=\"choice\">"); sb.Append(productDisplay.DisplayPrice()); sb.Append("</span>"); if ((productDisplay.BasePrice < productDisplay.ListPrice) && (productDisplay.OverrideText.Trim().Length < 1)) { sb.Append("<label>" + SiteTerms.GetTerm(SiteTermIds.YouSave) + "</label>"); sb.Append("<span class=\"choice\">"); sb.Append(productDisplay.Savings.ToString("c") + " - " + productDisplay.SavingsPercent + System.Threading.Thread.CurrentThread.CurrentUICulture.NumberFormat.PercentSymbol); sb.Append("</span>"); } sb.Append("<div class=\"clear\"></div></div>"); model.PreRenderedPrices = sb.ToString(); }