Answer the question
In order to leave comments, you need to log in
How to prohibit changing sections of the 1C-Bitrix store when exchanging with 1c?
Hello!
Registered in init.php
AddEventHandler("iblock", "OnAfterIBlockElementAdd", "DropNAME");
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate", "DropNAME");
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate","SaveInOldSection");
function DropNAME($arFields)
{
if ($_REQUEST['mode']=='import') {
unset($arFields['NAME']);
unset($arFields['ACTIVE']);
}
}
function SaveInOldSection(&$arFields)
{
if ($_REQUEST['mode']=='import') {
$db_old_groups = CIBlockElement::GetElementGroups($arFields['ID'], true);
while($ar_group = $db_old_groups->Fetch()) {
if(!in_array($ar_group['ID'],$arFields['IBLOCK_SECTION'])) {
$arFields['IBLOCK_SECTION'][]=$ar_group['ID'];
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question