Jump to content

Округление цен (без копеек)

Recommended Posts

Подскажите, как правильно отредактировать код чтобы цена на сайте была без копеек? а то при импорте из excel цены выглядят так: 54, 379 руб, 259, 5279 руб...

public static function ps_round($value, $precision = 0, $round_mode = null)
        if ($round_mode === null) {
            if (Tools::$round_mode == null) {
                Tools::$round_mode = (int) Configuration::get('PS_PRICE_ROUND_MODE');

            $round_mode = Tools::$round_mode;

        switch ($round_mode) {
            case PS_ROUND_UP:
                return Tools::ceilf($value, $precision);
            case PS_ROUND_DOWN:
                return Tools::floorf($value, $precision);
            case PS_ROUND_HALF_DOWN:
            case PS_ROUND_HALF_EVEN:
            case PS_ROUND_HALF_ODD:
                return Tools::math_round($value, $precision, $round_mode);
            case PS_ROUND_HALF_UP:
                return Tools::math_round($value, $precision, PS_ROUND_HALF_UP);

Это исходный код.

Версия PS - 1.7.6

Заранее спасибо!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More