[email protected] wrote:I am using the 3.9 version of nopcommerce and my products use Product Attributes. I would like to change the price $0.00 to Prices From at $xx.xx. This product price (00.00) is displayed on home page.
There are a few answers to this question but the answers are outdated.
Can anyone help please?
What files to edit?
Location of Files?
Code that will work?
Many Thanks.
@Eduardo already told you best option to do from plugin.
If you want to custom core code ==>
Go:
\Libraries\Nop.Services\Catalog\PriceFormatter.cs
and Edit:
/// <summary>
/// Formats the price
/// </summary>
/// <param name="price">Price</param>
/// <param name="showCurrency">A value indicating whether to show a currency</param>
/// <param name="targetCurrency">Target currency</param>
/// <param name="language">Language</param>
/// <param name="priceIncludesTax">A value indicating whether price includes tax</param>
/// <param name="showTax">A value indicating whether to show tax suffix</param>
/// <returns>Price</returns>
public virtual string FormatPrice(decimal price, bool showCurrency,
Currency targetCurrency, Language language, bool priceIncludesTax, bool showTax)
{
//we should round it no matter of "ShoppingCartSettings.RoundPricesDuringCalculation" setting
price = RoundingHelper.RoundPrice(price);
//Do you login here if price zero
string currencyString = GetCurrencyString(price, showCurrency, targetCurrency);
if (showTax)
{
//show tax suffix
string formatStr;
if (priceIncludesTax)
{
formatStr = _localizationService.GetResource("Products.InclTaxSuffix", language.Id, false);
if (String.IsNullOrEmpty(formatStr))
formatStr = "{0} incl tax";
}
else
{
formatStr = _localizationService.GetResource("Products.ExclTaxSuffix", language.Id, false);
if (String.IsNullOrEmpty(formatStr))
formatStr = "{0} excl tax";
}
return string.Format(formatStr, currencyString);
}
return currencyString;
}