Magento 1 – How to Display Price Including Tax

catalog-price-rulesmagento-1pricetax

Currently we use this code to display the price of products on our homepage. But this does load the price excluding tax.

How can I edit the code that the price will be including tax?

<?php
$first_amount_before_split = substr($_product->getPrice(), 0, -2);
$my_array = explode(".", $first_amount_before_split);
?>
<a href="<?php echo $_product->getProductUrl() ?>">
    <span class="sticker-wrapper top-right home">
        <span class="sticker prijs">
            <span class="main-price"><?php echo $my_array[0]; ?>,</span>
            <span class="sub-price"><?php echo $my_array[1]; ?></span>
        </span>
    </span>
</a>

EDIT:

The price is displaying including tax with this code.
But it skips the last 0's. So $49,90 becomes $49,9
How can I display 2 decimals

<?php $first_amount_before_split = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice()); 
$my_array = explode(".", $first_amount_before_split); ?>

Thanks.

Best Answer

Try this in you phtml file.

$_priceIncludingTax = Mage::helper('tax')
                      ->getPrice($_product, $_product->getFinalPrice());