GetPrice will use the raw values of the price group, which means that VAT will not be included.
var pricingService = ObjectFactory.Instance.Resolve<IPricingService>(); // get unit price without VAT PriceGroupPrice unitPrice = pricingService.GetProductPrice(product, pricegroup);
// get tax if applicaple var taxService = ObjectFactory.Instance.Resolve<ITaxService>(); Money unitTax = taxService.CalculateTax(product, priceGroup, unitPrice);
You can use the reference docs to find the location of the interfaces (there's handy serach function at the top). There's always a correlation between the root namespace and the DLL, e.g. the UCommerce.Infrastructure namespace is inthe UCommerce.Infrastructure.dll.
this seems to work well, but if you use basket.PurchaseOrder.OrderTotal it doesn't use the new TaxService, so includes VAT reagrdless, and neither does SiteContext.Current.OrderContext.GetBasket().PurchaseOrder.OrderLines.Sum(x => x.Total)
I assume I just can't use these and need to handle this myselff. Is this correct?
Also, are there any plans to handle vatable and non vatable products in a cleaner manner?
The reason for this behavior is that the basket pipeline needs to recalculate VAT based on any applied disocunts.
For your scenario the simplest is to set the VATRate field on the order lines in question to zero, which means you can leave the basket pipeline as is.
Alternatively you can replace the calculate order lines VAT task with your own.
VAT price in usercontrol
Hi,
I have a usercontrol and i can't seem to figure out how to get the vat inclusive price of an item. I have:
Can someone tell me what i should be using please?
Thanks
Chris
GetPrice will use the raw values of the price group, which means that VAT will not be included.
Thanks Soren,
What references do i need in my ascx as it doesn't seem to recognise ObjectFactory or Money?
Chris
UCommerce.Infrastructure.ObjectFactory is in the UCommerce.Infrastructure.dll and UCommerce.Money is in the UCommerce.dll
Thanks again Soren!
What about <IPricingService> and <ITaxService>, it can't seem to find them?
Thanks
Chris
ITaxService Interface
IPricingService Interface
You can use the reference docs to find the location of the interfaces (there's handy serach function at the top). There's always a correlation between the root namespace and the DLL, e.g. the UCommerce.Infrastructure namespace is inthe UCommerce.Infrastructure.dll.
Thanks Soren, i didn't know about them but i'll refer to them in future.
Thanks again
Chris
Soren,
this seems to work well, but if you use basket.PurchaseOrder.OrderTotal it doesn't use the new TaxService, so includes VAT reagrdless, and neither does SiteContext.Current.OrderContext.GetBasket().PurchaseOrder.OrderLines.Sum(x => x.Total)
I assume I just can't use these and need to handle this myselff. Is this correct?
Also, are there any plans to handle vatable and non vatable products in a cleaner manner?
Thanks
Tom
Hi Tom,
The reason for this behavior is that the basket pipeline needs to recalculate VAT based on any applied disocunts.
For your scenario the simplest is to set the VATRate field on the order lines in question to zero, which means you can leave the basket pipeline as is.
Alternatively you can replace the calculate order lines VAT task with your own.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.