Am I right in assuming if you are using the raw entities you need to calculate the total price + VAT yourself? There isn't any helper I'm missing?
Currently this seems to work:
var priceGroup = PriceGroup.Get(7); var price = product.GetPrice(priceGroup); var total = price.Price.Value + (price.Price.Value * priceGroup.VATRate); <h1>@priceGroup.Currency.ISOCode @total.ToCurrencyAmount()</h1>
You'll want to use IPricingService and ITaxService to get what you want. They encapsulate the logic for calculating price and tax and gives you the opportunity to override them later on if you need it:
var pricingService = ObjectFactory.Instance.Resolve<IPricingService>(); var taxService = ObjectFactory.Instance.Resolve<ITaxService>(); var product = Product.All().First(); PriceGroupPrice unitPriceExTax = pricingService.GetProductPrice(product, myCatalog); Money unitTax = taxService.CalculateTax(product, unitPriceExTax.PriceGroup, unitPriceExTax);
Getting Price + VAT for Product using Razor (C#)
Am I right in assuming if you are using the raw entities you need to calculate the total price + VAT yourself? There isn't any helper I'm missing?
Currently this seems to work:
Is that right or is there a better way?
Hi Dan,
You'll want to use IPricingService and ITaxService to get what you want. They encapsulate the logic for calculating price and tax and gives you the opportunity to override them later on if you need it:
Ahh, OK, that seems a lot more encapsualted. I thought there must be a way! Thanks again.
is working on a reply...