Commit ce8c6246 authored by Kulya's avatar Kulya 😊

Upd alvbx add prods11

parent 3f1dfec9
...@@ -385,7 +385,7 @@ class AloVoiceRest ...@@ -385,7 +385,7 @@ class AloVoiceRest
$arProduct = $result["result"]["products"][0]; $arProduct = $result["result"]["products"][0];
} }
if(empty($arProduct)){
$arNewProductParams = [ $arNewProductParams = [
"iblockId" => $conf["bx_catalog_id"], "iblockId" => $conf["bx_catalog_id"],
"name" => $data["name"], "name" => $data["name"],
...@@ -396,11 +396,11 @@ class AloVoiceRest ...@@ -396,11 +396,11 @@ class AloVoiceRest
"quantityTrace" => 'N', "quantityTrace" => 'N',
]; ];
if(!empty($data["price"])){ // if(!empty($data["price"])){
$arNewProductParams["priceType"] = $priceType; // $arNewProductParams["priceType"] = $priceType;
$arNewProductParams["purchasingCurrency"] = $currency; // $arNewProductParams["purchasingCurrency"] = $currency;
$arNewProductParams["purchasingPrice"] = $data["price"]; // $arNewProductParams["purchasingPrice"] = $data["price"];
} // }
if(!empty($conf["bxbillzfields"])){ if(!empty($conf["bxbillzfields"])){
foreach($conf["bxbillzfields"] as $bxf=>$blzf){ foreach($conf["bxbillzfields"] as $bxf=>$blzf){
...@@ -433,13 +433,7 @@ class AloVoiceRest ...@@ -433,13 +433,7 @@ class AloVoiceRest
]; ];
if($ik==0){ if($ik==0){
$arNewProductParams["previewPicture"] = $arPic;
$arNewProductParams["property100"] = $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 ...@@ -447,9 +441,15 @@ class AloVoiceRest
BillzRest::setLog($arNewProductParams); BillzRest::setLog($arNewProductParams);
if(empty($arProduct)){
$arProduct = BxRest::call('catalog.product.add',["fields"=>$arNewProductParams]); $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 = [ $arProdPrice = [
"product" => [ "product" => [
"id" => $arProduct["result"]["element"]["id"], "id" => $arProduct["result"]["element"]["id"],
...@@ -465,7 +465,7 @@ class AloVoiceRest ...@@ -465,7 +465,7 @@ class AloVoiceRest
$arProduct = BxRest::call('catalog.price.modify',["fields"=>$arProdPrice]); $arProduct = BxRest::call('catalog.price.modify',["fields"=>$arProdPrice]);
} }
}
} }
return $arProduct; 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