• Welcome to KonaKart Community Forum. Please login or sign up.
 

Showing Tax Total in Invoice

Started by mtoon, March 14, 2008, 03:20:42 pm

Previous topic - Next topic

mtoon

Hello there!
I'm trying to show the total amount of tax applied to the order in the subtotal area at the bottom of the invoice.  Here's the current code:

#foreach( $ot in $order.getOrderTotals() )
                    <tr>
                      <td align="right" class="dataTableContent">$ot.getTitle()</td>
                      <td align="right" class="dataTableContent">$ot.getText()</td>
                    </tr>
               #end

is there a specific property of $order that would show all the tax or another way to accomplish this?  is it possible to add the values of the taxed amount for each line together?

i.e.:
totalTax = totalTax + ($op.getTotalPriceIncTax() - $op.getTotalPriceExTax())?

Thank you!


heidi

Hello,

You can write loops in velocity templates to acheive that...  see http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html

Regards,
Heidi


mtoon

Thank you..  I'll check out variables..

here's another question.  I'm trying to show SKU on the invoice.  The OrderProductIf does not specifically have SKU, but it has getProduct() which returns ProductIf which has sku.  Velocity is not allowing me to make this call..
$op.getProduct().getSku()

Any thoughts?
Thanks!

julie

Hi,

The way to do this is to store the SKU in one of the custom fields of OrderProduct before saving the order, and then using it in the Velocity template. The Product attribute of the OrderProduct is not populated automatically when an order is retrieved from the database. It is really just a placeholder for the Product object, although all of the attributes that you really need should be stored in the OrderProduct since the product can change over time.

mtoon

Just wanted to follow up on this.  We kept trying to get Kona to show the tax (which was zero because our testing was out of state) and it wasn't until we were testing shipping within the taxed state that the tax line item showed up.  It's minor, but I wanted other people to know what we ran into.  We expected tax to show up as zero when there wasn't any tax, but it doesn't.  It would be nice if this was an option, but it works as is too.


pete

Hi,

If you want to change this default behaviour, just take a look at com.konakart.bl.modules.ordertotal.tax.Tax.java . You'll notice at around line 142:

        // Return null if there is no tax to pay
        if (order.getTax().compareTo(new BigDecimal(0)) == 0)
        {
            return null;
        }


mtoon