0

I want to remove the decimals of our price only on the list and product view. For example I want to change the price from $14,00 to $14,-

In the checkout, e-mails and PDF I want to keep the decimals for the tax.

How can I easily fix this?

1 Answer 1

2

If it's only on those specific places the easiest (not the prettiest) way to do it with a replace in the price.phtml.

$price = ...;
$price = str_replace(',00', ',-', $price); 

Another option would be to have a custom extension that rewrites the formatPrice method but since it's only visual that might be overkill.

So in price.html replace

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

with

<?php $_price = str_replace(',00', ',-', $_price); ?>
<?php echo $_coreHelper->formatPrice($_price, true) ?>
11
  • Thanks, I tried that! But I really do not know exactly what line I need to modify into what exactly. Because everything I tried in price.phtml did not work.
    – JGeer
    Feb 26, 2015 at 14:41
  • If you replaced all of them it might not be the right PHTML file. Please use template hints to check which file it is Feb 26, 2015 at 14:42
  • I did used the correct file. But there is non line that I can easily replace with $price = str_replace(',00', ',-', $price); What exact line do I need to replace in this file? I do see this line: <?php $_price = $_taxHelper->getPrice($_product, $_convertedPrice); ?>
    – JGeer
    Feb 26, 2015 at 14:45
  • every place where an echo is done parse what ever is echoed through the str_replace Feb 26, 2015 at 14:53
  • I don not quite get it. Can you give an example of a line?
    – JGeer
    Feb 26, 2015 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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