nasos75 Posted September 12, 2011 Share Posted September 12, 2011 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.annually}<br /> with: Method 1: {if $product.pricing.annually}{$product.pricing.annually} {php} $myvar=$this->get_template_vars('product'); $this->assign('vatvalue',number_format($myvar["pricing"]["rawpricing"]["annually"]*0.20,2,',','.')); {/php} (+ €{$vatvalue} {$LANG.vat})<br /> Method 2: {if $product.pricing.annually}{$product.pricing.annually} (+ €{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! 0 Quote Link to comment Share on other sites More sharing options...
Manchester Web Hosting Posted September 4, 2012 Share Posted September 4, 2012 Nice tutorial and a couple of options avalible too 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.