if CModule IncludeModule catalog arFields array SITE_ID s1 ACTIVE NAME

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if(CModule::IncludeModule("catalog")){
$arFields = array(
"SITE_ID" => "s1",
"ACTIVE" => "N",
"NAME" => "Тест программного создания скидки",
"COUPON" => "",
"SORT" => "305",
"VALUE_TYPE" => "S",
"VALUE" => "3280.00",
"CURRENCY" => "RUB",
"RENEWAL" => "N",
"CONDITIONS" => array(
"CLASS_ID" => "CondGroup",
"DATA" => array(
"All" => "AND",
"True" => "True"
),
"CHILDREN" => array(
array("CLASS_ID" => "CondIBElement",
"DATA" => array(
"logic" => "Equal",
"value" => array(40456)
)
)
)
)
);
$ID = CCatalogDiscount::Add($arFields);
$res = $ID>0;
if (!$res) {
$ex = $APPLICATION->GetException();
echo($ex->GetString());
}
}