bitrix очищать множественные свойства(поля) перед добавление/обновлением элемента
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
AddEventHandler( "iblock", "OnAfterIBlockElementAdd", array( "MultiFields", "emptyGallery" ) ); AddEventHandler( "iblock", "OnAfterIBlockElementUpdate", array( "MultiFields", "emptyGallery" ) ); class MultiFields { function emptyGallery( $arFields ){ CIBlockElement::SetPropertyValuesEx($arFields['ID'], 4, array("MORE_PHOTO" => Array ("VALUE" => array("del" => "Y")))); CIBlockElement::SetPropertyValuesEx($arFields['ID'], 4, array("CML2_TRAITS" => Array ("VALUE" => array("del" => "Y")))); CIBlockElement::SetPropertyValuesEx($arFields['ID'], 4, array("FILES" => Array ("VALUE" => array("del" => "Y")))); CIBlockElement::SetPropertyValuesEx($arFields['ID'], 4, array("CML2_TAXES" => Array ("VALUE" => array("del" => "Y")))); $file = fopen('logs/log.txt', 'a+'); $message = 'TIME: '.date('d.m.Y H:i:s').'ID: '.$arFields['ID'].': '.serialize($arFields['PROPERTY_VALUES']['MORE_PHOTO']).PHP_EOL.PHP_EOL; fwrite($file, $message); fclose($file); } } |