1

I want to load the price without the currency symbol on one single page. I load the price currently with this code:

<?php echo $this->getPriceHtml($_product, true) ?>

Thanks!

3
<?php echo $_product->getPrice() ?> 

should work if you have a product object in $product.

  • It works, but now it displays a price of $55.00 as 55.0000. How can I remove 2 numbers after the dot (.) So that it become 55.00? – Henk Z Jan 22 '15 at 16:26
  • Use substr($var, 0, -2); and remember to mark the answer as accepted. – mbalparda Jan 22 '15 at 16:29
  • I tried some code, but it did not work. What code should I completely use? – Henk Z Jan 22 '15 at 16:32
  • 1
    Remember this is not free consultation but a community site to help others. Code is really basic to any PHP user, <?php echo substr($_product->getPrice(), 0, -2) ?> – mbalparda Jan 22 '15 at 16:36
  • Sorry mbalparda, I keep that in mind! Thanks for your help – Henk Z Jan 22 '15 at 16:43
1

After get the $_product model, use the codes below to show price without currency, the second parameter true or false control the currency show or not.

Mage::helper('core')->currency($_product->getFinalPrice(), false, false)

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.