Товары - не товары

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
CModule::IncludeModule('catalog');
CModule::IncludeModule('iblock');
$cnt = 0;
$dbProduct=CIBlockElement::GetList(
Array("ID"=>"ASC"),
array("IBLOCK_ID"=>1),
false,
false,
Array("ID"));
while ($arProduct = $dbProduct->GetNext())
{
$IsProduct=CCatalogProduct::GetByID($arProduct['ID']);
if (!$IsProduct)
{
CCatalogProduct::Add(Array('ID'=>$arProduct['ID']));
$cnt++;
}
}
echo $cnt;