Commit 5126f0ca authored by Kulya's avatar Kulya 😊

Upd alvbx add prods2

parent a2c617c0
...@@ -306,9 +306,9 @@ class AloVoiceRest ...@@ -306,9 +306,9 @@ class AloVoiceRest
} }
} }
private function bx_process_product($data,$full=false) { private function bx_process_product($data=[],$full=false) {
/*
{ $data = json_decode('{
"ID": 1261574, "ID": 1261574,
"name": "*Tahorat va namoz", "name": "*Tahorat va namoz",
"sku": "Q001", "sku": "Q001",
...@@ -322,7 +322,7 @@ class AloVoiceRest ...@@ -322,7 +322,7 @@ class AloVoiceRest
"CATEGORY": "Kitob", "CATEGORY": "Kitob",
"COLLECTION": "", "COLLECTION": "",
"COLOR": "", "COLOR": "",
"DESCRIPTION": "Tahorat lug'atda poklikdir. Poklik – inson tabiatan rag'bat qiladigan go'zal sifatlarning biridir. Islom dini insonlarni poklikka targ'ib qiladi va o'zlarini pok tutuvchilarni maqtaydi. \"Albatta Alloh tavba qilguvchilarni va o'zlarini mudom pok tutguvchilarni sevadi\" (Baqara - 222). Hadisi sharifda Rasululloh sollallohu alayhi vasallam: \"poklik iymonning yarmidir\", deb aytganlar. (Buxoriy rivoyati).", "DESCRIPTION": "Tahorat lug`atda poklikdir. Poklik – inson tabiatan rag`bat qiladigan go`zal sifatlarning biridir. Islom dini insonlarni poklikka targ`ib qiladi va o`zlarini pok tutuvchilarni maqtaydi. \"Albatta Alloh tavba qilguvchilarni va o`zlarini mudom pok tutguvchilarni sevadi\" (Baqara - 222). Hadisi sharifda Rasululloh sollallohu alayhi vasallam: \"poklik iymonning yarmidir\", deb aytganlar. (Buxoriy rivoyati).",
"GENDER": "", "GENDER": "",
"SEASON": "", "SEASON": "",
"SIZE": "14*21", "SIZE": "14*21",
...@@ -330,7 +330,7 @@ class AloVoiceRest ...@@ -330,7 +330,7 @@ class AloVoiceRest
"АВТОР": "", "АВТОР": "",
"ВЕС": "220gr", "ВЕС": "220gr",
"ЖАНР": "", "ЖАНР": "",
"ИЗДАТЕЛЬСТВО": "G'afur G'ulom nashryot-matbaa ijodiy uyi", "ИЗДАТЕЛЬСТВО": "G`afur G`ulom nashryot-matbaa ijodiy uyi",
"КОЛИЧЕСТВО_СТРАНИЦ": "185", "КОЛИЧЕСТВО_СТРАНИЦ": "185",
"НАПРАВЛЕНИЕ": "Kitoblar", "НАПРАВЛЕНИЕ": "Kitoblar",
"ПОДКАТЕГОРИЯ2": "Din ahkomlari (namoz, zakot..)", "ПОДКАТЕГОРИЯ2": "Din ahkomlari (namoz, zakot..)",
...@@ -353,9 +353,12 @@ class AloVoiceRest ...@@ -353,9 +353,12 @@ class AloVoiceRest
} }
], ],
"totalRows": 990 "totalRows": 990
} }',1);
*/
if(empty($data)){
return false;
}
$conf = self::get_billzconf(); $conf = self::get_billzconf();
$currency = 'UZS'; $currency = 'UZS';
$result = false; $result = false;
...@@ -415,14 +418,50 @@ class AloVoiceRest ...@@ -415,14 +418,50 @@ class AloVoiceRest
} }
if(!empty($data["imageUrls"])){ if(!empty($data["imageUrls"])){
foreach($data["imageUrls"] as $ik=>$img){
$arImage = $this->get_image_by_url($img["url"]);
if(!empty($arImage["name"]) && !empty($arImage["base64"])){
$arPic = [
"value" => [
"fileData" => [
$arImage["name"],
$arImage["base64"]
]
]
];
if($ik==0){
$arNewProductParams["previewPicture"] = $arPic;
}
elseif($ik==1){
$arNewProductParams["detailPicture"] = $arPic;
}
}
}
} }
$arProduct = BxRest::call('catalog.product.list',$arNewProductParams); $arProduct = BxRest::call('catalog.product.add',$arNewProductParams);
} }
} }
return $arProduct; return $arProduct;
} }
private function get_image_by_url($url=false) {
$url = "https://app.billz.uz/fileupload/products/2021/02/25/901F535D975D24B3334CC40D4DC62922_022521120712_square.jpeg";
if(empty($url)){
return false;
}
$arInfo = pathinfo($url);
$data = base64_encode(file_get_contents($url));
$return = [
'name' => $arInfo["basename"],
'base64' => $data,
];
return $return;
}
private function billz_products_all_synch($r=false) { private function billz_products_all_synch($r=false) {
$tms["0_begin"] = time(); $tms["0_begin"] = time();
$return = ["result"=>false]; $return = ["result"=>false];
......
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