Reputation: 65
how can I remove/turn off <span class="price">...</span>
from
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
in
<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
i was change last argument to false and price print without <span class="price">...</span>
so I wonder how can I do in
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
I dont want change core file. Thx for help.
Upvotes: 1
Views: 4655
Reputation: 101
In Magento, when using
Mage::helper('checkout')->formatPrice($price);
to get $price in local format, it prints $price which is enclosed by <span class=”price”></span>
. In some case, this is not very pratical. If you don’t like this <span>
tag much, you can use this method:
Mage::helper('checkout')->getQuote()->getStore()->formatPrice($price, false);
http://ntuan16.wordpress.com/2011/12/20/how-to-use-formatprice-without-tag/
Upvotes: 0
Reputation: 2384
You have to rewrite the Checkout Helper (Data.php) to your Namespace, to overwrite this function :
public function formatPrice($price)
{
return $this->getQuote()->getStore()->formatPrice($price);
}
replace it with
public function formatPrice($price,$includeContainer = false)
{
return $this->getQuote()->getStore()->formatPrice($price,$includeContainer);
}
Then you'll just need this :
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?
to Hide the span and :
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice(),true) ?
to get it back.
Upvotes: 0