Blog navigation keyboard_arrow_down

Blog Rss rss_feed

How to make prices without a point

How to make prices without a point

Everyone knows that in PrestaShop prices are displayed by default-two decimal places. And what if you want a numeric value without points?

This problem can be solved in several ways, one of which we will consider in this article.

Чтобы не изменять ядро нашей CMS, воспользуемся функцией «Overrides». Перейдём в папку:

/override/classes/

To override the core class, create file a Tools.php

class Tools extends ToolsCore

In this class, you should find the output of the price, namely the displayPrice() method and replace the line

return $cldr->getPrice($price, is_array($currency) ? $currency['iso_code'] : $currency->iso_code);

on

return ceil($price).' '. $currency->sign;

image-5_4.png

 As a result, we get prices without points, rounded up.

Was this blog post helpful to you?

    
No comments at this moment
close

Checkout

close

Favourites