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?

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) ?>
  • 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. – Henk Z Feb 26 '15 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 – Sander Mangel Feb 26 '15 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); ?> – Henk Z Feb 26 '15 at 14:45
  • every place where an echo is done parse what ever is echoed through the str_replace – Sander Mangel Feb 26 '15 at 14:53
  • I don not quite get it. Can you give an example of a line? – Henk Z Feb 26 '15 at 14: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.