почему-то отработало только через гетлист просто через update не работает не понимаю почему, вот рабочий вариант вдруг кому пригодится
[CODE]
function ReActiveDiscount(){
global $USER;
if (!is_object($USER)) $USER = new CUser;
$hours=date("H");
$minutes = date("i");
CModule::IncludeModule('catalog');
if ($hours=='17'){
$dbProductDiscounts = CCatalogDiscount::GetList(
array("SORT" => "ASC"),
array("ACTIVE" => "Y", ),
false,
false,
array("ID", "ACTIVE")
);
while ($arProductDiscounts = $dbProductDiscounts->Fetch())
{
if ($arProductDiscounts["ID"]=="7" || $arProductDiscounts["ID"]=="8"){
$znak=CCatalogDiscount::Update($arProductDiscounts["ID"], array("ACTIVE" => "N"));
if (!znak){mail('pochta@yandex.ru', 'увы', 'no');}
else{mail('pochta@yandex.ru', 'Скидка id='.$arProductDiscounts["ID"], 'Выключена в '.$hours.' часов '.$minutes.' минут');}
}
}
}elseif ($hours=='18'){
$dbProductDiscounts = CCatalogDiscount::GetList(
array("SORT" => "ASC"),
array("ACTIVE" => "N", ),
false,
false,
array("ID", "ACTIVE")
);
while ($arProductDiscounts = $dbProductDiscounts->Fetch())
{
if ($arProductDiscounts["ID"]=="7" || $arProductDiscounts["ID"]=="8"){
$znak=CCatalogDiscount::Update($arProductDiscounts["ID"], array("ACTIVE" => "Y"));
if (!znak){mail('pochta@yandex.ru', 'увы', 'no');}
else{mail('pochta@yandex.ru', 'Скидка id='.$arProductDiscounts["ID"], 'Включена в '.$hours.' часов '.$minutes.' минут');}
}
}
}
else{
continue;
}
return "ReActiveDiscount();";
}
[/CODE]