A
A
Alexander2020-10-18 19:48:27
1C-Bitrix
Alexander, 2020-10-18 19:48:27

How to prohibit some changes to elements when unloading from a 1C site?

To prevent updating fields on an element, I do this:

AddEventHandler("iblock", "OnBeforeIBlockElementUpdate","DoNotUpdate");
function DoNotUpdate(&$arFields)
{
    if ($_REQUEST['mode']=='import')
    {
        unset($arFields['PREVIEW_PICTURE']);
        unset($arFields['DETAIL_PICTURE']);
        unset($arFields['PREVIEW_TEXT']);
        unset($arFields['DETAIL_TEXT']);
    }
}

But this solution only works when synchronizing changes; when a full unload is done, everything is overwritten.
How to prohibit and for full unloading?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kinash, 2020-10-19
@Dementor

Why not just look at the contents of your package?
Surely there mode is not equal to "import", but something like "full_import" or "reload".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question