private void BindData() { var productVariant = this.ProductService.GetProductVariantById(this.ProductVariantId); if (productVariant != null) { if (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") || (NopContext.Current.User != null && !NopContext.Current.User.IsGuest)) { if (productVariant.CustomerEntersPrice) { phOldPrice.Visible = false; lblPrice.Visible = false; lblPriceValue.Visible = false; phDiscount.Visible = false; lblCustomerEnterPrice.Visible = true; lblCustomerEnterPrice.Text = GetLocaleResourceString("Products.EnterProductPrice"); } else { if (productVariant.CallForPrice) { lblPriceValue.Text = GetLocaleResourceString("Products.CallForPrice"); phOldPrice.Visible = false; phDiscount.Visible = false; } else { decimal taxRate = decimal.Zero; decimal oldPriceBase = this.TaxService.GetPrice(productVariant, productVariant.OldPrice, out taxRate); decimal finalPriceWithoutDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false), out taxRate); decimal finalPriceWithDiscountBase = this.TaxService.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, true), out taxRate); Discount discount = PriceHelper.GetPriceDiscount(productVariant); decimal oldPrice = this.CurrencyService.ConvertCurrency(oldPriceBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); decimal finalPriceWithoutDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithoutDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); decimal finalPriceWithDiscount = this.CurrencyService.ConvertCurrency(finalPriceWithDiscountBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase > decimal.Zero) { lblOldPrice.Text = PriceHelper.FormatPrice(oldPrice); lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount); phOldPrice.Visible = true; } else { lblPriceValue.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscount); phOldPrice.Visible = false; } if (object.ReferenceEquals(discount, null)) { phDiscountPercent.Visible = false; } else { lblDiscountPercent.Text = PriceHelper.FormatDiscount(discount.DiscountPercentage); } if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase) { lblFinalPriceWithDiscount.Text = PriceHelper.FormatPrice(finalPriceWithDiscount); phDiscount.Visible = true; } else { phDiscount.Visible = false; } if (phDiscount.Visible) { lblPriceValue.CssClass = "noDiscountPrice"; } else { lblPriceValue.CssClass = "productPrice"; } if (phDiscount.Visible || phOldPrice.Visible) { lblPrice.Text = GetLocaleResourceString("Products.FinalPriceWithoutDiscount"); } if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate")) { string pattern = this.SettingManager.GetSettingValue("ProductAttribute.PricePattern", "(?<val>(\\d+[\\s\\,\\.]?)+)"); string replacement = String.Format("<span class=\"price-val-for-dyn-upd-{0}\">${{val}}</span> ", productVariant.ProductVariantId); if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase) { lblFinalPriceWithDiscount.Text = Regex.Replace(lblFinalPriceWithDiscount.Text, pattern, replacement); } else { lblPriceValue.Text = Regex.Replace(lblPriceValue.Text, pattern, replacement); } } } } } else { this.Visible = false; } } else { this.Visible = false; } }