Answer the question
In order to leave comments, you need to log in
How to replace field values in init.php when uploading from 1C to Bitrix?
Good day. The question is that I need to write "Full name" (from 1Ski) in the property (id=C1_NAME) of the product, since "Full name" overwrites the announcement of the product and this is a necessity.
I wrote the following in init.php:
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate", "DropPreviewText");
AddEventHandler("iblock", "OnBeforeIBlockElementAdd", "DropPreviewText");
function DropPreviewText($arFields)
{
if (@$_REQUEST['mode']=='import')
{
if($arFields['IBLOCK_ID']==5 && strstr($_SERVER['REQUEST_URI'],'1c_exchange. php')) {
$arFields['C1_NAME'] = $arFields['PREVIEW_TEXT'];
}
}
But it doesn't work.
When unloading, the information of this property successfully changes to a new one (which was set in 1C) and is also present in the unloading files (which means it unloads with a bang and this is not the problem), but how to access the property and change the value before the Full name is deleted and the goods are recorded ...
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