1.You need to add new field in TierPriceModel public decimal PriceValue {get;set;} 2. I am not sure which nop version are you using? so you need to just set PriceValue = without formatting. 3. either do code at controller level or same page you use PriceValue so it should be achieve your requirement.
n _ProductTierPrices.cshtml page we can't get the product original price. It should be requires to show percentage base calculation.
I think you need to modify ProductTemplate.Simple.cshtml page for using Product original price. @await Html.PartialAsync("_ProductTierPrices", Model.TierPrices) replace with @await Html.PartialAsync("_ProductTierPrices", Model)
then make change in _ProductTierPrices.cshtml file according to use ProductDetailsModel model whole page lke Model.TirePrice in foreach loop etc..
Percentage Calculation should be
@foreach (var tierPrice in Model.TierPrices) { var tirepriceStr = tierPrice.Price.Replace("$", ""); var tirepriceValue = Convert.ToDecimal(tirepriceStr); var subtractedPrice = Convert.ToDecimal(Model.ProductPrice.PriceValue - tirepriceValue); var calulatedPercentage = (subtractedPrice / Model.ProductPrice.PriceValue) * 100; <td class="item-price"> @*@tierPrice.Price*@ @calulatedPercentage.ToString("0.##")% OFF </td> }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.