コード例 #1
0
        public virtual async Task <string> GetBasePriceInfoAsync(Product product, Customer customer = null, Currency currency = null, decimal priceAdjustment = decimal.Zero)
        {
            Guard.NotNull(product, nameof(product));

            customer ??= _workContext.CurrentCustomer;
            currency ??= _workContext.WorkingCurrency;

            if (product.BasePriceHasValue && product.BasePriceAmount != decimal.Zero)
            {
                var currentPrice = await GetFinalPriceAsync(product, customer, includeDiscounts : true);

                var price = await _taxService.GetProductPriceAsync(product, decimal.Add(currentPrice, priceAdjustment), currency : currency, customer : customer);

                price = _currencyService.ConvertFromPrimaryStoreCurrency(price, currency);

                return(_priceFormatter.GetBasePriceInfo(product, price, currency));
            }

            return(string.Empty);
        }