M
M
man0max2014-12-19 18:01:52
1C-Bitrix
man0max, 2014-12-19 18:01:52

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

1 answer(s)
S
Sergey, 2014-12-19
@gangstarcj

When unloading from 1C, you can only process data after unloading using
AddEventHandler('catalog', 'OnSuccessCatalogImport1C', 'customCatalogImportStep');
Here is an example
I was also looking for tried other events. TP just said

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question