S
S
SteepNET2020-04-19 16:39:29
1C-Bitrix
SteepNET, 2020-04-19 16:39:29

Updating/filling Bitrix price types?

Good afternoon! Please tell me, I'm trying to collect a subscription to an event when converting the exchange rate!

1. Added new Price types: USD, EUR
2. Therefore, the product has new price types: USD, EUR

Task: Update \ fill in these price types for the product when updating the exchange rate in terms of the base one at the established exchange rate.

In init.php I began to think something like

AddEventHandler("currency", "OnCurrencyRateUpdate", "CurrencyUpdate");
function CurrencyUpdate()
{
    CModule::IncludeModule('iblock');
    CModule::IncludeModule('catalog');
    CModule::IncludeModule('currency');

    $obElements = \Bitrix\Iblock\ElementTable::getList([
        'select' => ["ID"],
        'filter' => ["IBLOCK_ID" => 1]
    ]);

    $el = new CIBlockElement;
    while ($result = $obElements->fetch()) {
        $el->Update($result["ID"], []);
}


This is the implementation of dynamic multicurrency on the site by the selector.
In the smart filter, it is necessary to display the currency, which was successfully done, but there was a difficulty with filling in these prices in currencies.
There are very few examples, information on the Internet ..
It doesn’t work, I will be grateful for tips, help ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2020-04-21
@rpsv

Go through the prices with the desired type and update, you don’t need to touch the elements themselves, the price is stored separately: https://dev.1c-bitrix.ru/api_d7/bitrix/catalog/pri...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question