We need to display the sales tax rate on our order emails (part of the WA state sales tax fun) to help our accounting group check orders.
Adding it to the order items list would be just fine. To do this, I'm presuming we would need to look at the item type. I'm still trying to wrap my brain around the nVelocity code to do that.
Does anyone have code prebuilt to display the sales tax rate in some way on their emails? Code fragments?
Display sales tax rate
Re: Display sales tax rate
$store.TaxRules.get_Item(x).TaxRate
x is the Collection index of the rule, but what we have is the Id of the rule written in OrderItem.Sku for tax lines (if you are using Able tax calculation).
Seems like TaxRules.IndexOf(Id) should work, but it doesn't - nVelocity borks and writes out the code.
Sorry. If you are using Able tax, writing the rate in TaxRule.Name might be your best solution; maybe Mazhar's nVelocity foo is stronger than mine...
x is the Collection index of the rule, but what we have is the Id of the rule written in OrderItem.Sku for tax lines (if you are using Able tax calculation).
Seems like TaxRules.IndexOf(Id) should work, but it doesn't - nVelocity borks and writes out the code.
Sorry. If you are using Able tax, writing the rate in TaxRule.Name might be your best solution; maybe Mazhar's nVelocity foo is stronger than mine...
Nick Cole
http://www.ethofy.com
http://www.ethofy.com
Re: Display sales tax rate
try following code where you want to out put the tax rate
Code: Select all
#set( $foo = $orderItem.Sku + 0)
TAX RATE = $store.TaxRules.get_item($store.TaxRules.IndexOf($foo)).TaxRate %
#end
Re: Display sales tax rate
Thanks guys. I took a third route and had the tax line item appear with the order line items.
That got the information on the email for now. I'll look at the code you've provided for a more elegant solution moving forward.
Thanks!
Code: Select all
($orderItem.OrderItemType == "Tax")
Thanks!
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: Display sales tax rate
I suspect with 7.0.1 release and higher, there are better tax features to assist with this. OrderItem has new fields TaxRate and TaxAmount that can assist with invoicing and regulatory issues such as this. For the 7.0 release, it looks like the suggestions above are valid enough.WylieE wrote:That got the information on the email for now. I'll look at the code you've provided for a more elegant solution moving forward.
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Re: Display sales tax rate
You should also give a try to code posted by me above. It was working for me.