AddEventHandler("catalog", "OnBeforeProductUpdate", "OnBeforeProductUpdate");
function OnBeforeProductUpdate(&$ID,$Fields)
{
$iblock_id = 99;
$IBLOCK_SECTION_ID = 999;
$my_elements = CIBlockElement::GetList (
Array("IBLOCK_ID" => $iblock_id, "ACTIVE" => "Y", "SECTION_ID" => $IBLOCK_SECTION_ID , "INCLUDE_SUBSECTIONS" => "Y" ),
false,
Array(
'ID',
'PROPERTY_kol_VALUE',
'PROPERTY_kol'
)
);
while($ar_fields = $my_elements->GetNext())
{
$res=Array("QUANTITY"=> $ar_fields['PROPERTY_kol_VALUE']);
}
CCatalogProduct::Update($ID,$res,$PRODUCT_ID);
}
AddEventHandler("catalog", "OnProductUpdate", "OnProductUpdate");
function OnProductUpdate(&$ID,$Fields)
{
$iblock_id = 99;
$IBLOCK_SECTION_ID = 999;
$my_elements = CIBlockElement::GetList (
Array("ID" => "ASC"),
Array("IBLOCK_ID" => $iblock_id, "ACTIVE" => "Y", "SECTION_ID" => $IBLOCK_SECTION_ID , "INCLUDE_SUBSECTIONS" => "Y" ),
false,
false,
Array(
'ID',
'PROPERTY_kol_VALUE',
'PROPERTY_kol'
)
);
while($ar_fields = $my_elements->GetNext())
{
$res=Array("QUANTITY"=> $ar_fields['PROPERTY_kol_VALUE']);
}
CCatalogProduct::Update($ID,$res,$PRODUCT_ID);
}
AddEventHandler("catalog", "OnProductUpdate", "OnProductUpdate");
function OnProductUpdate(&$ID,$Fields)
{
if ($SECTION_ID = 400)
{
$res=Array("QUANTITY"=>$Fields['kol']);
CCatalogProduct::Update($ID,$res,$SECTION_ID );
}
}
function pr45($new)
{
global $USER;
$arFavorites = array();
$idUser = $USER->GetID();
$rsUser = CUser::GetByID($idUser);
$arUser = $rsUser->Fetch();
$arFavorites = $arUser['UF_FAVORITES'];
echo implode(', ', $arFavorites), "<br>\n";
return $arFavorites;
}
<?if (in_array($arItem['ID'], pr45($new))) {
echo "active";
}?>