<?
$arProp = array();
$arProp[55] = $arr[6];
$arProp[56] = $arr[7];
$arProp[144] = $arr[15];
$PROP = array();
$PROP[57] = $arr[9];
$PROP[58] = $arr[10];
$PROP[59] = $arr[11];
$PROP[60] = $arr[12];
$PROP[62] = $arr[14];
$PROP[147] = $arr[16];
$arFields = array(
'NAME' => $na,
'DETAIL_TEXT' => $arr[16],
'IBLOCK_ID' => $intProductIBlock,
'ACTIVE' => 'Y',
'DETAIL_PICTURE' => CFile::MakeFileArray($rtt),
"PROPERTY_VALUES"=> $PROP,
);
$intProductID = $obElement->Add($arFields); // добавили товар, получили ID
$arFields = Array(
"PRODUCT_ID" => $intProductID,
"CATALOG_GROUP_ID" => 1,
"PRICE" => $arr[4],
"CURRENCY" => "RUB",
"QUANTITY_FROM" => 1,
"QUANTITY_TO" => 10
);
$res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $intProductID,
"CATALOG_GROUP_ID" => 1
)
);
if ($arr11 = $res->Fetch())
{
CPrice::Update($arr11["ID"], $arFields);
}
else
{
CPrice::Add($arFields);
}
CCatalogProduct::Add(Array("ID"=>$intProductID,"QUANTITY"=>$arr[2], "QUANTITY_TRACE"=>"N" ));
$arFields = Array(
"PRODUCT_ID" => $intProductID,
"CATALOG_GROUP_ID" =>2,
"PRICE" => $arr[17],
"CURRENCY" => "RUB",
"QUANTITY_FROM" => 1,
"QUANTITY_TO" => 10
);
$res = CPrice::GetList(
array(),
array(
"PRODUCT_ID" => $intProductID,
"CATALOG_GROUP_ID" => 2
)
);
if ($arr11 = $res->Fetch())
{
CPrice::Update($arr11["ID"], $arFields);
}
else
{
CPrice::Add($arFields);
}
if ($intProductID)
{
$arProp[$intSKUProperty] = $intProductID;
$arFields0 = array(
'NAME' => $arr[5],
'IBLOCK_ID' => $intSKUIBlock,
"IBLOCK_SECTION_ID" => $ID1,
'ACTIVE' => 'Y',
'PROPERTY_VALUES' => $arProp,
);
$intOfferID = $obElement->Add($arFields0);
}
?> |