Commit ce8c6246 authored by Kulya's avatar Kulya 😊

Upd alvbx add prods11

parent 3f1dfec9
......@@ -385,7 +385,7 @@ class AloVoiceRest
$arProduct = $result["result"]["products"][0];
}
if(empty($arProduct)){
$arNewProductParams = [
"iblockId" => $conf["bx_catalog_id"],
"name" => $data["name"],
......@@ -396,11 +396,11 @@ class AloVoiceRest
"quantityTrace" => 'N',
];
if(!empty($data["price"])){
$arNewProductParams["priceType"] = $priceType;
$arNewProductParams["purchasingCurrency"] = $currency;
$arNewProductParams["purchasingPrice"] = $data["price"];
}
// if(!empty($data["price"])){
// $arNewProductParams["priceType"] = $priceType;
// $arNewProductParams["purchasingCurrency"] = $currency;
// $arNewProductParams["purchasingPrice"] = $data["price"];
// }
if(!empty($conf["bxbillzfields"])){
foreach($conf["bxbillzfields"] as $bxf=>$blzf){
......@@ -433,13 +433,7 @@ class AloVoiceRest
];
if($ik==0){
$arNewProductParams["previewPicture"] = $arPic;
$arNewProductParams["property100"] = $arPic;
$arPic["value"]["fileData"][1] = 'data:image/' . $arImage["extension"] . ';base64,' . $arImage["base64"];
$arNewProductParams["detailPicture"] = $arPic;
}
elseif($ik==1){
$arNewProductParams["detailPicture"] = $arPic;
}
}
}
......@@ -447,9 +441,15 @@ class AloVoiceRest
BillzRest::setLog($arNewProductParams);
if(empty($arProduct)){
$arProduct = BxRest::call('catalog.product.add',["fields"=>$arNewProductParams]);
}
else {
$arProduct = BxRest::call('catalog.product.update',["id"=>$result["result"]["products"][0] ,"fields"=>$arNewProductParams]);
}
if(!empty($arProduct["result"]["element"]["id"])){
if(!empty($arProduct["result"]["element"]["id"]) && !empty($data["price"])){
$arProdPrice = [
"product" => [
"id" => $arProduct["result"]["element"]["id"],
......@@ -465,7 +465,7 @@ class AloVoiceRest
$arProduct = BxRest::call('catalog.price.modify',["fields"=>$arProdPrice]);
}
}
}
return $arProduct;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment