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><?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?



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

  • Doh! As simple as that eh? Thank you @Marius, for spotting what I couldn't. It works perfectly now. – Alistair67 Dec 11 '14 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.