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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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