本文整理汇总了C#中Nop.Core.Domain.Catalog.Product.FormatBasePrice方法的典型用法代码示例。如果您正苦于以下问题:C# Product.FormatBasePrice方法的具体用法?C# Product.FormatBasePrice怎么用?C# Product.FormatBasePrice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nop.Core.Domain.Catalog.Product
的用法示例。
在下文中一共展示了Product.FormatBasePrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareProductDetailsPageModel
//.........这里部分代码省略.........
decimal finalPriceWithDiscountBase = _taxService.GetProductPrice(product, _priceCalculationService.GetFinalPrice(product, _workContext.CurrentCustomer, includeDiscounts: true), out taxRate);
//for group deal
if (product.SpecialPrice != null)
{
model.ProductPrice.SpecialPriceValue = _currencyService.ConvertFromPrimaryStoreCurrency(Convert.ToDecimal(product.SpecialPrice), _workContext.WorkingCurrency);
model.ProductPrice.SpecialPrice = _priceFormatter.FormatPrice(System.Convert.ToDecimal(model.ProductPrice.SpecialPriceValue));
model.ProductPrice.FinalPriceWithoutSpecialPrice = _currencyService.ConvertFromPrimaryStoreCurrency(product.Price, _workContext.WorkingCurrency);
}
decimal oldPrice = _currencyService.ConvertFromPrimaryStoreCurrency(oldPriceBase, _workContext.WorkingCurrency);
decimal finalPriceWithoutDiscount = _currencyService.ConvertFromPrimaryStoreCurrency(finalPriceWithoutDiscountBase, _workContext.WorkingCurrency);
decimal finalPriceWithDiscount = _currencyService.ConvertFromPrimaryStoreCurrency(finalPriceWithDiscountBase, _workContext.WorkingCurrency);
if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase > decimal.Zero)
model.ProductPrice.OldPrice = _priceFormatter.FormatPrice(oldPrice);
model.ProductPrice.Price = _priceFormatter.FormatPrice(finalPriceWithoutDiscount);
if (finalPriceWithoutDiscountBase != finalPriceWithDiscountBase)
model.ProductPrice.PriceWithDiscount = _priceFormatter.FormatPrice(finalPriceWithDiscount);
model.ProductPrice.PriceValue = finalPriceWithDiscount;
model.ProductPrice.PriceWithDiscountValue = finalPriceWithDiscount;
//property for German market
//we display tax/shipping info only with "shipping enabled" for this product
//we also ensure this it's not free shipping
model.ProductPrice.DisplayTaxShippingInfo = _catalogSettings.DisplayTaxShippingInfoProductDetailsPage
&& product.IsShipEnabled &&
!product.IsFreeShipping;
//PAngV baseprice (used in Germany)
model.ProductPrice.BasePricePAngV = product.FormatBasePrice(finalPriceWithDiscountBase,
_localizationService, _measureService, _currencyService, _workContext, _priceFormatter);
//currency code
model.ProductPrice.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode;
//rental
if (product.IsRental)
{
model.ProductPrice.IsRental = true;
var priceStr = _priceFormatter.FormatPrice(finalPriceWithDiscount);
model.ProductPrice.RentalPrice = _priceFormatter.FormatRentalProductPeriod(product, priceStr);
}
}
}
}
else
{
model.ProductPrice.HidePrices = true;
model.ProductPrice.OldPrice = null;
model.ProductPrice.Price = null;
}
#endregion
#region 'Add to cart' model
model.AddToCart.ProductId = product.Id;
model.AddToCart.UpdatedShoppingCartItemId = updatecartitem != null ? updatecartitem.Id : 0;
//quantity