Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Simon Osborne 108 posts 150 karma points
    Aug 08, 2011 @ 13:12
    Simon Osborne
    0

    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

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 08, 2011 @ 21:59
    Søren Spelling Lund
    0

    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.

  • Simon Osborne 108 posts 150 karma points
    Aug 12, 2011 @ 16:04
    Simon Osborne
    0

    Hi Soren,

    I got round to wrting the custom tax service, but when I apply it in the components.config I get:

    No component for supporting the service UCommerce.Catalog.ITaxService was found

    I thought it may mean it couldn't see the dll but when I remove the dll from the bin folder I get:

    InnerException    Could not convert from 'ExemptTaxService.ExemptTaxService, ExemptTaxService' to System.Type - Maybe type could not be found

    The my service class implements ITaxService by implementing the CalculateTax Function, and I get no errors when I build. Any suggestions?

     

    Thanks Simon

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 15, 2011 @ 14:50
    Søren Spelling Lund
    0

    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:

     

    <component id="TaxService" service="UCommerce.Catalog.ITaxService, UCommerce"type="UCommerce.Catalog.TaxService, UCommerce" lifestyle="Singleton"/>

     

    To register a new serivce make sure that you only change the "type" attribute and point it at your class and assembly:

    <component id="TaxService" service="UCommerce.Catalog.ITaxService, UCommerce"type="ExemptTaxService.ExemptTaxService, ExemptTaxService" lifestyle="Singleton"/>

    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.

  • Simon Osborne 108 posts 150 karma points
    Aug 15, 2011 @ 16:42
    Simon Osborne
    0

    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

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 15, 2011 @ 17:59
    Søren Spelling Lund
    0

    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.

  • Simon Osborne 108 posts 150 karma points
    Aug 15, 2011 @ 22:11
    Simon Osborne
    0

    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:

    <configuration>
    <components>
    <!-- Pipeline Instance -->
    <component id="Basket"
    service="UCommerce.Pipelines.IPipeline`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.BasketPipeline, UCommerce.Pipelines"
    lifestyle="Thread">
    <parameters>
    <tasks>
    <array>
    <value>${Basket.CalculatePaymentFees}</value>
    <value>${Basket.CalculateOrderLinesTotals}</value>
    <value>${Basket.CalculateShippingCostForShipments}</value>
    <value>${Basket.CalculateShippingTotal}</value>
    <value>${Basket.CalculatePaymentTotal}</value>
    <value>${Basket.CalculateVATTotal}</value>
    <value>${Basket.CalculateOrderTotal}</value>
    <value>${Basket.Save}</value>
    </array>
    </tasks>
    </parameters>
    </component>

    <!-- Pipeline Tasks-->
    <component id="Basket.CalculatePaymentFees"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculatePaymentFeesTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.CalculateOrderLinesTotals"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculateOrderLineTotalsTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.CalculateShippingCostForShipments"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculateShippingCostForShipmentsTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.CalculateShippingTotal"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculateShippingTotalTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.CalculatePaymentTotal"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculatePaymentTotalTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.CalculateVATTotal"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculateOrderVatTotalTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.CalculateOrderTotal"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Basket.CalculateOrderTotalTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Basket.Save"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Common.SavePurchaseOrderTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    </components>
    </configuration>

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 16, 2011 @ 16:01
    Søren Spelling Lund
    0

    Hi Simon,

    I was referring to uCommerce 2, but your install looks like a 1.0. Which version are you running?

  • Simon Osborne 108 posts 150 karma points
    Aug 16, 2011 @ 16:18
    Simon Osborne
    0

    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:

    <configuration>
    <components>
    <!-- Pipeline Instance -->
    <component id="Checkout"
    service="UCommerce.Pipelines.IPipeline`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.CheckoutPipeline, UCommerce.Pipelines"
    lifestyle="Thread">
    <parameters>
    <tasks>
    <array>
    <value>${Checkout.AssignOrderNumber}</value>
    <value>${Checkout.CreateCustomer}</value>
    <value>${Checkout.CreateMemberForCustomer}</value>
    <value>${Checkout.ConvertBasketToPurchaseOrder}</value>
    <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value>
    <value>${Checkout.SetVoucherUses}</value>
    <value>${Checkout.ClearBasketInformation}</value>
    <value>${Checkout.SavePurchaseOrder}</value>
    <value>${Checkout.SendConfirmationEmail}</value>
    </array>
    </tasks>
    </parameters>
    </component>

    <!-- Pipeline Tasks-->
    <component id="Checkout.CreateCustomer"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.CreateCustomerTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.CreateMemberForCustomer"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.CreateMemberForCustomerTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.AssignOrderNumber"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.AssignOrderNumberTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.ConvertBasketToPurchaseOrder"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.ConvertBasketToPurchaseOrderTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.SavePurchaseOrder"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Common.SavePurchaseOrderTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.AddAuditTrailForCurrentOrderStatus"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Common.AddAuditTrailForCurrentOrderStatusTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.ClearBasketInformation"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.ClearBasketInformationTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.SetVoucherUses"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Checkout.SetVoucherUsesTask, UCommerce.Pipelines"
    lifestyle="Thread" />
    <component id="Checkout.SendConfirmationEmail"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
    type="UCommerce.Pipelines.Common.SendEmailTask, UCommerce.Pipelines"
    lifestyle="Thread">
    <parameters>
    <emailTypeName>OrderConfirmation</emailTypeName>
    </parameters>
    </component>
    </components>
    </configuration>

    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

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 16, 2011 @ 16:52
    Søren Spelling Lund
    0

    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.

  • Simon Osborne 108 posts 150 karma points
    Aug 17, 2011 @ 13:39
    Simon Osborne
    0

    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?:

        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)

        End Function

     

    Thanks,

    Simon

     

  • Simon Osborne 108 posts 150 karma points
    Aug 17, 2011 @ 16:59
    Simon Osborne
    1

    I have tried:

     If Convert.ToBoolean(product.ParentProduct.ProductProperties.SingleOrDefault(Function(x) x.ProductDefinitionField.Name = "TaxExempt")) = False Then

    But it says "Object reference not set to an instance of an object." Help please.

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 17, 2011 @ 19:34
    Søren Spelling Lund
    0

    I'm not too sure about the indexer syntax of VB. It's been years since I wrote it last. Try this:

    Dim taxExampt As String = product("TaxExempt")

    Let me know if it works out for you.

  • Simon Osborne 108 posts 150 karma points
    Aug 18, 2011 @ 10:28
    Simon Osborne
    0

    Hi Soren,

    unfortunately I get:

    Value of type 'UCommerce.EntitiesV2.ProductProperty' cannot be converted to 'String'.

    Looking at the following, isn't it going to be in a Linq format?:

    http://www.publicvoid.dk/QueryingProductsByCustomPropertiesInUCommerce.aspx

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 18, 2011 @ 10:59
    Søren Spelling Lund
    0

    My bad. I forgot to add a .Value at end :)

    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. 

  • Simon Osborne 108 posts 150 karma points
    Aug 18, 2011 @ 12:11
    Simon Osborne
    0

    Great, its all working now. Thanks for all your help :)

  • Kenny Burns 173 posts 305 karma points
    Jan 30, 2012 @ 15:59
    Kenny Burns
    0

    Great stuff! :)

  • Kieran Harvey 22 posts 55 karma points
    Sep 13, 2012 @ 05:18
    Kieran Harvey
    0

    I have followed the steps but it is not working for me.

    ../UCommerce/Configuration/Components 

    <component id="TaxService"
        service="UCommerce.Catalog.ITaxService, UCommerce"
        type="AMS101.UCommerceCustomisation.CalculateTaxService, AMS101" lifestyle="Singleton"/>

    Implement ITaxService 

    public class CalculateTaxService :ITaxService{
    public Money CalculateTax(Product product, PriceGroup priceGroup, PriceGroupPrice unitPrice) {
    return new Money( 500m, Currency.FirstOrDefault( x => x.ISOCode == "AUD" ) );
    }
    }

    removed line from basket config

     <!--<value>${Basket.CalculateOrderLineTax}</value>-->

    Can any one tell me what I am doing wrong? CalculateTax is never called. I am using uCommerce version: 2.6.1.0

     

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Sep 17, 2012 @ 11:25
    Søren Spelling Lund
    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.

Please Sign in or register to post replies

Write your reply to:

Draft