V
V
Vladimir Kai2016-09-06 09:29:40
PHP
Vladimir Kai, 2016-09-06 09:29:40

How to remove pennies in the order amount after applying the discount - Bitrix 16 version?

Good day everyone!
Actually the problem is as follows:
The prices in the online store for the Bitrix CMS are loaded without kopecks,
for example - 10500 rubles.
But after applying the Bitrix discounts, the prices in the order become a penny.
The buyer does not see this, and thank God! But the manager of the online store has to manually edit orders every time, first in 1C UT, because the exchange of the site and the 1C UT database is set up. Then do a manual exchange with the site.
This is half the trouble, after making changes through 1C UT, the amount of the order for Bitrix does not change even if the amount payable inside the order changes and remains with a penny. It is logical that after saving any changes, they fly back to 1C UT and the quotation continues on a new one!
Help "kill" hated pennies!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Stanislav Harakhnin, 2016-09-06
@Chupokabr

You can set the rounding settings here <your site>/bitrix/admin/currency_edit.php?lang=ru&ID=RUB
If this does not help, then you can add your handler to init.php to format all prices

<?
// Задать свой формат вывода цены можно следующим образом
AddEventHandler("currency", "CurrencyFormat", "myFormat");
function myFormat($fSum, $strCurrency)
{
   return number_format ( $fSum, 2, '.', ' ' ).' Рублей.';
}
// Пример вывода
echo CurrencyFormat(1234.5678, 'RUB');
?>

You can also hang handlers on these events OnCountPriceWithDiscountResult and OnGetOptimalPriceResult of the catalog module.

S
Sergey, 2016-09-06
@Logic87

You will have to program and use special handlers when placing an order. Not much has been written about this on the Internet.
But you can use a simple ready-made solution and simplify your life - https://marketplace.1c-bitrix.ru/solutions/askaron...

O
Oleg Maksimenko, 2016-09-06
@olegprof

And where do the pennies come from? Prices with pennies or after applying discounts?

A
Andrey, 2016-09-09
@Andrey052

If everything on the site works as it should and the user does not see the cents. Then you can simply add rounding to the "object module" in the Order in UT document, the procedure Before Recording (<Rejection>, <Recording Mode>, <Conducting Mode>) .
Each time you record your order in UT, everything will be rounded off by itself, I think this is the simplest solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question