Answer the question
In order to leave comments, you need to log in
Why does the Bitrix agent error occur?
Agents on hits
There is an agent adFoo();
in php init
function adFoo()
{
if(CModule::IncludeModule("iblock")){
$el = new CIBlockElement;
$IBLOCK_ID_CATALOG = 53;
$arLoadProductArray = Array(
"IBLOCK_ID" => $IBLOCK_ID_CATALOG,
"NAME" => "тест1",
"ACTIVE" => "Y",
"PREVIEW_TEXT" => "Позиция успешно добавлена",
);
$newElement = $el->Add($arLoadProductArray);
}
return "adFoo();";
}
Answer the question
In order to leave comments, you need to log in
I will assume that $USER->GetID() is called, the documentation states that the $USER variable is not in the agents. . Apparently, this module has an event for adding an infoblock element, in which $USER->GetID() is called, and so on. $USER=null and not an object of class CUser you get an error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question