artofadornment Posted April 1, 2013 Share Posted April 1, 2013 I'm using 1.5.3.1 and I'm hoping there is a way to add the tax % rate to two things: the shopping cart summary (shopping_cart.tpl) and the order detail (order_detail.tpl) views. 1.) Currently, the shopping cart shows the label "Total Tax:", but I'd like to have the % rate show beside the label (e.g. "Total Tax 12%:"). No idea how to do this. In fact... since my province (BC, Canada) just switched back to having two sales taxes instead of one, if possible I'd like to be able to show both rates when relevant (e.g. "Total Tax 5% + 7%:"). Since my tax rules are already set up with two rates for BC (state zone ID# 88, if that helps anyone), this should technically be possible. Although if that's too much of a pain to code I can always switch back to having only one rate set for BC (12%) and leave it at that. But the important thing is that any % being charged should display. 2.) Currently the order detail view doesn't even have a line for tax, which frankly amazes me (bit of an oversight there), and is an even bigger problem since I have no idea how to add that, never mind how to add the % as well. I may experiment with coping some code from the shopping cart but I suspect that may not work - I'm no developer. Any help you can offer would be greatly appreciated! ~ Elaine Link to comment Share on other sites More sharing options...
artofadornment Posted April 1, 2013 Author Share Posted April 1, 2013 Update: YES!!! I did find a way to add a tax line to order_detail.tpl, it's a little dirty but it works: <tr class="item"> <td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}"> {l s='Total tax'}: <span class="price-tax">{displayWtPriceWithCurrency price=$order->total_paid - $order->total_paid_tax_excl currency=$currency}</span> </td> However still no clue how to add the tax %. :/ 1 Link to comment Share on other sites More sharing options...
artofadornment Posted April 18, 2013 Author Share Posted April 18, 2013 Can anyone help with this? Link to comment Share on other sites More sharing options...
agilepixel Posted April 25, 2013 Share Posted April 25, 2013 Hello I'm also trying to achieve the same thing, I found in the debug that the $product array contains "rate" which is the numeric value, but this is applied to each product and isn't a global value. so {foreach $products as $product} {assign var='mastertaxrate' value=$product.rate} {$mastertaxrate} {/foreach} returns the VAT rate (no % but you can add that on) for each item in the basket... looking at a better solution but it's a start Link to comment Share on other sites More sharing options...
agilepixel Posted April 25, 2013 Share Posted April 25, 2013 Here you go, not an ideal solution but a solution of sorts {foreach $products as $product} {if $product@index == 1}{assign var='mastertaxrate' value=$product.rate} {$mastertaxrate}%{/if} {/foreach} Link to comment Share on other sites More sharing options...
artofadornment Posted April 25, 2013 Author Share Posted April 25, 2013 Thanks agilepixel, but what file are you referring to? I'd like to try out your solution but I have no idea where to put it. Link to comment Share on other sites More sharing options...
agilepixel Posted April 26, 2013 Share Posted April 26, 2013 Ah yes, that would probably be helpful, I've added that to shopping-cart.tpl around lines 200, but it should work pretty much anywhere on that template. Link to comment Share on other sites More sharing options...
artofadornment Posted April 28, 2013 Author Share Posted April 28, 2013 (edited) Thanks. However I couldn't get it to work. I tried inserting your code as-is next to the Total Tax label and it broke the entire page. Then tried taking the variable assign out of that spot and putting it among the other variables around line 150 under {foreach $products as $product}, and left only {$mastertaxrate}% next to the label. I got "0%" to show in the cart view, but the actual rate wasn't grabbed. It seems I still need to define something, somewhere... Edited April 28, 2013 by artofadornment (see edit history) Link to comment Share on other sites More sharing options...
artofadornment Posted April 28, 2013 Author Share Posted April 28, 2013 (edited) Did some experimenting, and had some limited success. Using $product.tax_rate instead of $product.rate shows the rate for the currently selected delivery address (YAY!), but doesn't update when the delivery address is changed (it just stays the same rate). And that's as far as I can go without more guidance, my knowledge of this stuff stops here. Anyone? Edited April 28, 2013 by artofadornment (see edit history) Link to comment Share on other sites More sharing options...
Ganesh Hipparkar Posted January 22, 2014 Share Posted January 22, 2014 (edited) hi everyone, I also had the same problem of show tax in cart in the % only instead of Rs like following attachement. Thanks,Ganesh. Edited January 22, 2014 by Ganesh Hipparkar (see edit history) Link to comment Share on other sites More sharing options...
Ganesh Hipparkar Posted January 22, 2014 Share Posted January 22, 2014 hey i resolved that issue . i ill put solution below it may help some one. search this path first :- Wamp/www/presta1.5/themes/theme799/js/modules/blockcart/ajax-cart.js In ajax-cart.js Line no 693: $('.ajax_cart_tax_cost').text (jsonData.taxCost); Replace above line with following code var subtotal = jsonData.taxCost; var regex = /[+-]?\d+\.\d+/g; var floats = subtotal.match(regex).map(function(v) { return parseFloat(v); }); var taxPer=floats/10; $('.ajax_cart_tax_cost').text(taxPer.toFixed(2)+" %"); but this change is apply at only cart not for shopping cart summary at checkout process. Link to comment Share on other sites More sharing options...
Nyla C. Posted January 29, 2016 Share Posted January 29, 2016 This helped me and I can confirm it works in Presta v 1.6.1.4. Thank you! Update: YES!!! I did find a way to add a tax line to order_detail.tpl, it's a little dirty but it works: <tr class="item"> <td colspan="{if $return_allowed || $order->hasProductReturned()}{if $order->hasProductReturned() && $return_allowed}7{else}6{/if}{else}5{/if}"> {l s='Total tax'}: <span class="price-tax">{displayWtPriceWithCurrency price=$order->total_paid - $order->total_paid_tax_excl currency=$currency}</span> </td>However still no clue how to add the tax %. :/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now