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.

  • Nauman 98 posts 118 karma points
    Oct 26, 2010 @ 12:08
    Nauman
    0

    Product price without VAT

    Hi Soren / others

    I have a price group that includes VAT with prices, on product pages price is showing inclusive of VAT. Is there a way I can show price without VAT

    current: GBP 117.5

    desired: GBP 100 + VAT

    How can I get the product price without VAT to display on product page?

    Regards

    Nauman

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 26, 2010 @ 15:57
    Søren Spelling Lund
    0

    Hi Nauman,

    uCommerce produces just a single price for you so you'll have to do a custom XSLT extension to get the result you're after.

    Assuming that we're working with option "Show prices with VAT" turned off.

    To get the VAT you need a custom XSLT extension which can call a .NET class for you. The class you want is called TaxService. Your XSLT extension will take as an argument Sku and optionally VariantSku and will then call the TaxService to get VAT for you.

    It could look a little like this:

    public static XPathNodeIterator GetProductVat(string catalogName, string sku, string variantSku)
    {
      Product product = Product.SingleOrDefault(x => x.Sku == sku && x.VariantSku == variantSku);
      if (product == null) return;
    
      ProductCatalog catalog = ProductCatalog.SingleOrDefault(x => x.Name == catalogName);
      if (catalog == null) return;
    
      // pricing service always works with prices excluding VAT
      var pricingService = ObjectFactory.Instance.Resolve<IPricingService>();
      PriceGroupPrice price = pricingService.GetProductPrice(catalog, product);
    
      var taxService = ObjectFactory.Instance.Resolve<ITaxService>();
      Money vat = taxService.CalculateTax(product, catalog.PriceGroups.Single(), price);
    
      // Output vat variable as XML or do the code as part of a control
    }

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft