my clients carries adult and kids clothing in the same store. Adult clothing is at 20% VAT whilst kids is VAT exempt (0%).
Whilst I can enter the price into the second PriceGroup text box for 0% VAT it doesn't render the price. It looks as if PriceGroup and therefore the tax rate is set for the whole ProductCatalogue. Other than setting up a sperate ProductCatalogue, is there a way to enabel products of different tax bands to co-exist.
The easiest way is to define just one price group with 20% VAT and handle the dynamic VAT with a custom ITaxService. You'll need an indication on each product as to whether it's VAT exampt.
With the tax service in place you need to replace the default one in /umbraco/ucommerce/configuration/components.config.
It means that the registration for ITaxService is not present in Components.config (it's probably there, but there's the name is off somehow). Here's what the default registration looks like:
If you already did that please check the name of your assembly, which should be ExemptTaxService.dll and that it's present in the /bin folder of your website. Also make sure that the class "ExemptTaxService" exists in the namespace "ExemptTaxService" and implements the ITaxService interface.
thanks for replying - yes changing the service name fixed the error. I now get the situation that even though the tax amount has been fixed at 10% the amount calculated is 20% on each product.
I have checked that the service is being called and that 10.00 is what is being returned by making an entry in the Umbraco Log.
How is it still getting a value of 20% and why is my Tax service return value being ignored?
I believe it's related to the basket pipeline, which will recalculate tax based on the TaxRate stored on the order line. If you remove the task called "Basket.CalculateOrderLineTax" from the pipeline your original value will be retained.
I have looked in the uCommerce/Pipelines/Basket.config but cannot see the task you mentioned. Should I be adding or removing anything in the following:
thanks I have updated all config file in the pipeline folder and commented out the line "Basket.CalculateOrderLineTax" and that now is getting the value from my TaxService.
In my Tax service what then would be the syntax for accessing the TaxExempt property from the product?:
Public Function CalculateTax(ByVal product As UCommerce.EntitiesV2.Product, ByVal priceGroup As UCommerce.EntitiesV2.PriceGroup, ByVal unitPrice As UCommerce.EntitiesV2.PriceGroupPrice) As UCommerce.Money Implements ITaxService.CalculateTax
Dim taxAmount As Decimal = 0 Try If Not product.ProductProperties.SingleOrDefault(??? "TaxExempt" ???).Value Is Nothing Then If product.IsVariant Then If Convert.ToBoolean(product.ParentProduct.ProductProperties.SingleOrDefault(??? "TaxExempt" ???)) = False Then taxAmount = product.ParentProduct.GetPrice(priceGroup).Price * priceGroup.VATRate End If Else If Convert.ToBoolean(product.ProductProperties.SingleOrDefault(??? "TaxExempt" ???)) = False Then taxAmount = product.GetPrice(priceGroup).Price * priceGroup.VATRate End If End If Else taxAmount = product.GetPrice(priceGroup).Price * priceGroup.VATRate End If Catch
End Try
Return New Money(taxAmount, CultureInfo.InvariantCulture, priceGroup.Currency)
Dim taxExempt As String = product("TaxExempt").Value
As for the LINQ question you're right that you can grab the value like that as well. You'll mainly use LINQ when you need to search across multiple products and their properties.
Products with different Tax values in the same category/shop
Hi,
my clients carries adult and kids clothing in the same store. Adult clothing is at 20% VAT whilst kids is VAT exempt (0%).
Whilst I can enter the price into the second PriceGroup text box for 0% VAT it doesn't render the price. It looks as if PriceGroup and therefore the tax rate is set for the whole ProductCatalogue. Other than setting up a sperate ProductCatalogue, is there a way to enabel products of different tax bands to co-exist.
Thanks,
Simon
Hi Simon,
The easiest way is to define just one price group with 20% VAT and handle the dynamic VAT with a custom ITaxService. You'll need an indication on each product as to whether it's VAT exampt.
With the tax service in place you need to replace the default one in /umbraco/ucommerce/configuration/components.config.
Let me know how you get on.
Hi Soren,
I got round to wrting the custom tax service, but when I apply it in the components.config I get:
I thought it may mean it couldn't see the dll but when I remove the dll from the bin folder I get:
The my service class implements ITaxService by implementing the CalculateTax Function, and I get no errors when I build. Any suggestions?
Thanks Simon
Hi Simon,
It means that the registration for ITaxService is not present in Components.config (it's probably there, but there's the name is off somehow). Here's what the default registration looks like:
To register a new serivce make sure that you only change the "type" attribute and point it at your class and assembly:
If you already did that please check the name of your assembly, which should be ExemptTaxService.dll and that it's present in the /bin folder of your website. Also make sure that the class "ExemptTaxService" exists in the namespace "ExemptTaxService" and implements the ITaxService interface.
Hi Soren,
thanks for replying - yes changing the service name fixed the error. I now get the situation that even though the tax amount has been fixed at 10% the amount calculated is 20% on each product.
I have checked that the service is being called and that 10.00 is what is being returned by making an entry in the Umbraco Log.
How is it still getting a value of 20% and why is my Tax service return value being ignored?
Thanks,
Simon
Hi Simon,
I believe it's related to the basket pipeline, which will recalculate tax based on the TaxRate stored on the order line. If you remove the task called "Basket.CalculateOrderLineTax" from the pipeline your original value will be retained.
Hi Soren,
I have looked in the uCommerce/Pipelines/Basket.config but cannot see the task you mentioned. Should I be adding or removing anything in the following:
Hi Simon,
I was referring to uCommerce 2, but your install looks like a 1.0. Which version are you running?
Hi,
uCommerce 2.0.1.0 was installed over the top of 1.5.0.2. This caused a number of issues:
http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/22093-Admin-node-empty-uCommerce-upgrade
I needed to update my local copy which is now posted below, but it seems still to be missing the required line:
Looks like this also needs to be manually updated also. If so can you send me a copy of the config file for me to overwrite it?
Thanks Simon
Hi Simon,
Does the app pool identity have access to update files? Files might not be updated if write permissions aren't assigned to the identity.
If you download the package from our site and open it in WinZip you can find the original files in the /umbraco/ucommerce/pipelines folder.
Hi Soren,
thanks I have updated all config file in the pipeline folder and commented out the line "Basket.CalculateOrderLineTax" and that now is getting the value from my TaxService.
In my Tax service what then would be the syntax for accessing the TaxExempt property from the product?:
Thanks,
Simon
I have tried:
But it says "Object reference not set to an instance of an object." Help please.
I'm not too sure about the indexer syntax of VB. It's been years since I wrote it last. Try this:
Let me know if it works out for you.
Hi Soren,
unfortunately I get:
Looking at the following, isn't it going to be in a Linq format?:
http://www.publicvoid.dk/QueryingProductsByCustomPropertiesInUCommerce.aspx
My bad. I forgot to add a .Value at end :)
As for the LINQ question you're right that you can grab the value like that as well. You'll mainly use LINQ when you need to search across multiple products and their properties.
Great, its all working now. Thanks for all your help :)
Great stuff! :)
I have followed the steps but it is not working for me.
../UCommerce/Configuration/Components
Implement ITaxService
removed line from basket config
Can any one tell me what I am doing wrong? CalculateTax is never called. I am using uCommerce version: 2.6.1.0
Tax is only calculated when new order lines are created on the basket. Make sure that you're working with a blank basket when testing it out.
is working on a reply...