Results 1 to 3 of 3

Thread: How to display VAT in order templates

  1. #1
    Join Date
    Jan 2011
    Location
    Athens, Greece
    Posts
    68

    Cool How to display VAT in order templates

    WHMCS has an option to define tax in your prices as inclusive or exclusive. So, let's say you have a product which you sell for 100 euros + 20% VAT. If you choose the inclusive method, your clients will see the the product's price 120 euros in the order form and 100 + 20 in the cart process. If you choose the exclusive method, your clients will see the product's price 100 euros in the order form and 100 + 20 in the cart checkout process.

    Personally, I wanted to display the price excluding VAT (so I chose the exclusive method) but I wanted my clients to be aware of the VAT value or total price before checking out. I made that with two methods, in templates/web20cart/products.tpl (change web20cart and products.tpl for your installation accordingly).

    Find the {foreach key=num item=product from=$products} line, and bellow that line are the definitions for one-time/monthly/etc prices. So, let's say we want to change the yearly price:

    Change the line {if $product.pricing.annually}{$product.pricing.annual ly}<br /> with:

    Method 1: {if $product.pricing.annually}{$product.pricing.annual ly} {php} $myvar=$this->get_template_vars('product'); $this->assign('vatvalue',number_format($myvar["pricing"]["rawpricing"]["annually"]*0.20,2,',','.')); {/php} (+ &euro;{$vatvalue} {$LANG.vat})<br />

    Method 2: {if $product.pricing.annually}{$product.pricing.annual ly} (+ &euro;{math equation="x * 0.20" x=$product.pricing.rawpricing.annually format="%.2f"} {$LANG.vat})<br />

    In both methods, the $LANG.vat variable is the word VAT in my language files. The advantage of the first method is that you can define number_format with plain php but is more complex, and the advantage of the second method is that you can not define the number format (comma in decimals instead of dot) but is simpler. In the same way, you can change any other template for any other product.

    I hope I helped!
    Greek comunity WHMCS modules
    .gr & DomainBox Registrar Modules, AlphaBank/EuroBank/PiraeusBank Gateway Modules
    www.valuehost.com.gr

  2. #2
    Join Date
    Sep 2011
    Posts
    55

    Default

    Quote Originally Posted by nasos75 View Post
    WHMCS has an option to define tax in your prices as inclusive or exclusive. So, let's say you have a product which you sell for 100 euros + 20% VAT. If you choose the inclusive method, your clients will see the the product's price 120 euros in the order form and 100 + 20 in the cart process. If you choose the exclusive method, your clients will see the product's price 100 euros in the order form and 100 + 20 in the cart checkout process.

    Personally, I wanted to display the price excluding VAT (so I chose the exclusive method) but I wanted my clients to be aware of the VAT value or total price before checking out. I made that with two methods, in templates/web20cart/products.tpl (change web20cart and products.tpl for your installation accordingly).

    Find the {foreach key=num item=product from=$products} line, and bellow that line are the definitions for one-time/monthly/etc prices. So, let's say we want to change the yearly price:

    Change the line {if $product.pricing.annually}{$product.pricing.annual ly}<br /> with:

    Method 1: {if $product.pricing.annually}{$product.pricing.annual ly} {php} $myvar=$this->get_template_vars('product'); $this->assign('vatvalue',number_format($myvar["pricing"]["rawpricing"]["annually"]*0.20,2,',','.')); {/php} (+ &euro;{$vatvalue} {$LANG.vat})<br />

    Method 2: {if $product.pricing.annually}{$product.pricing.annual ly} (+ &euro;{math equation="x * 0.20" x=$product.pricing.rawpricing.annually format="%.2f"} {$LANG.vat})<br />

    In both methods, the $LANG.vat variable is the word VAT in my language files. The advantage of the first method is that you can define number_format with plain php but is more complex, and the advantage of the second method is that you can not define the number format (comma in decimals instead of dot) but is simpler. In the same way, you can change any other template for any other product.

    I hope I helped!
    Thanks good tutorial.

  3. #3
    Join Date
    Nov 2009
    Location
    Salford UK
    Posts
    77

    Default

    Nice tutorial and a couple of options avalible too
    Umbrella Host Fast, Affordable and Reliable UK Web Hosting
    FREE Web Hosting + .co.uk Domain & Business Web Hosting
    VPS Cloud Hosting, UK Dedicated Servers, Magento Hosting, Reseller Hosting
    Manchester Web Host Contact: [email protected] Phone: +44 (0)844 585 6005

Similar Threads

  1. 20% VAT from Germany? German VAT ID not accepted?
    By Locutus in forum Pre-Sales Questions
    Replies: 2
    Last Post: 07-01-11, 10:41 PM
  2. Vat and non VAT invoices reports.
    By milamber in forum Customisation & Integration Questions
    Replies: 0
    Last Post: 05-31-09, 11:24 AM
  3. Feedback - Order form - Total Recurring shows inc VAT
    By xperience in forum Feature Requests
    Replies: 2
    Last Post: 09-28-07, 10:03 AM
  4. Product display order
    By webresellers in forum Feature Requests
    Replies: 7
    Last Post: 01-25-07, 01:20 AM