1

I want to remove the decimals and replace this with a symbol on the list and product view.

I only want to edit those two files.

I want to edit the price.phtml and I need to modify this line especially for this:

<?php echo $_coreHelper->formatPrice($_price, true) ?>

How can I edit the price from €1.100,00 to €1.100,-?

2

This will do the trick. The negative length in the substr call will trim the end for you.

<?php
    $myPrice = $_coreHelper->formatPrice($_price, false);
    $myPrice = substr($myPrice, 0, -2);
    $myPrice = $myPrice . '-?';
    echo '<span class="price">'.$myPrice.'</span>';
?>

result : €1.100,-?

Echoing the <span> tags is up to you, you don't necessarily need the container but you may want to have it, or to set another class, etc.

To filter by prices with '00' as the decimals, and only insert the symbols on those prices:

<?php
    $myPrice = $_coreHelper->formatPrice($_price, false);
    $zeros = substr($myPrice, -2);
    if(strval($zeros) == "00") {
        $myPrice = substr($myPrice, 0, -2);
        $myPrice = $myPrice . '-?';
    }
    echo '<span class="price">'.$myPrice.'</span>';
?>
  • Many thanks! Works great! But is there also a way to do this: When a price is €1.100,- it will be displayed just like that. But when a price is €1.100,99 it will be displayed with the 2 decimals? So only if a price got two 00 as decimals it will be displayed as ,- – Henk Z Apr 7 '15 at 11:09
  • That changes the original question - I am posting this within the original answer for formatting's sake, you should modify your original question and accept the answer if it works for you. – AreDubya Apr 7 '15 at 15:32

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.