Magento – how to get tax amount of a product in success page

magento-1.8magento-1.9

I want to get tax amount of a product in success page. I'm getting price of a product but not tax amount from order object. can anyone please help me on this. Thanks

Best Answer

Try this:

echo Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount')

in your checkout success page.

Hope this helps.

update

$orderId = $this->getOrderId();

$items = Mage::getResourceModel('sales/order_item_collection')->load($orderId);
foreach($items as $item){
   echo '<pre>'.$item->getName() . ' ' . $item->getTaxAmount().'<pre>';
}

Note: I haven't tested it but should work.