How to Add Text After the Price in Magento 1.9

magento-1.9

When you choose to display prices both including and excluding tax, the text 'Incl. Tax' and 'Excl. Tax' appear after the respective prices. We are only displaying the price excluding tax, but no corresponding text appears after the price. I want to add this.

I was looking at editing the price.phtml file, based on advice found here about adding text before a price. I reasoned that adding

<span><?php echo $this->_("Excl. Tax") ?></span>

after the span containing the price rather than before it would have the desired effect. So I ended up with

<?php else: ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php if ($_finalPrice == $_price): ?>
<?php echo $_coreHelper->formatPrice($_price, true) ?>
<?php else: ?>
<?php echo $_coreHelper->formatPrice($_finalPrice, true) ?>
<?php endif; ?>
</span>
<span><?php echo $this->_("Excl. Tax") ?></span>

after line 206.

However, this just ended up causing an error when I tried to load the page:

a:5:{i:0;s:83:"Invalid method Mage_catalog_Block_Product_Price::_(Array
(
[0] => Excl. VAT
)
)";i:1;s:3968:

Am I barking up completely the wrong tree? Is the code just slightly wrong or totally the wrong idea?

Thanks

Best Answer

You missed an underscore.
This $this->_("Excl. Tax") should be $this->__("Excl. Tax")

Related Topic