0

I would like to display the product price without tax and the tax amount of a single product from a order in Magento.

I have the item already loaded:

$qty                 =$item->getData('qty_ordered');
$sku                 =$item->getSku();
$name                =$item->getName();
$tax                 =$item->getTaxAmount()/$qty;
$price_incl_tax      =$item->getPriceInclTax();
$price_excl_tax      =$price_incl_tax-$tax;

This is working but I don't think this is a good solution. Is there a easier way without calculating the price in PHP by myself?

Thanks in advance!

Edit: I need this:

$_product = $item->getProduct();
$finalPriceExcludingTax = 
Mage::helper('tax') ->getPrice($_product, $_product->getFinalPrice(), false );

usable on ordered items, with the price the customers has payed.

Vidarrus
  • 175
  • 4
  • 18

1 Answers1

0

try to use tax helper:

$_product = $item->getProduct()
$finalPriceExcludingTax = $this->helper('tax')
    ->getPrice($_product, $_product->getFinalPrice(), false );
amr
  • 61
  • 1
  • 8
  • I receive "Fatal error: Using $this when not in object", does your solution refer to the order, or to the product? – Vidarrus Jul 10 '16 at 19:14
  • please, try to change it to: $finalPriceExcludingTax = Mage::helper('tax') ->getPrice($_product, $_product->getFinalPrice(), false ); – amr Jul 10 '16 at 19:23
  • The last one works! But I still have a problem: It shows the "updated-today" price of the product, and I would like to have the price "when the customer orders". For e.g. customer buys product for 100€, now in the meantime the price increases to 110€, your script would show the net price calculated on 110€ and not on the price, that the customer has ordered in the past. :( I would like to use it in a export-all-orders script, which I created by myself. – Vidarrus Jul 10 '16 at 19:30
  • I think it might be because you have flats turned on, please try to change your magento setting to price indexer on save. – amr Jul 11 '16 at 18:37