public function getImageWithBaseArticleID() { $id = addslashes($_GET['id']); $type = addslashes($_GET['type']); //if($id == "")die("no id"); if ($id == "" || $id < 1) { $json['status_code'] = 0; $json['status_message'] = "No ID"; echo json_encode($json); die; } $ll = new LL_Article_WImage(); $arr = $ll->getWhere("BaseArticleID = '{$id}' AND ArticleType = 'Base' LIMIT 0,1"); $ll = $arr[0]; if ($type != 1) { $type = 2; } if ($type == 1) { $dipil = "BaseArticleImageFile"; } else { $dipil = "VariantImageFile"; } // $remoteImage = "http://192.168.0.86/ImageRepository/Article/Images/".$ll->$dipil; $remoteImage = Efiwebsetting::getData('ImageRepositoryURL') . $ll->{$dipil}; $imginfo = getimagesize($remoteImage); header("Content-type: " . $imginfo['mime']); readfile($remoteImage); exit; }
public function saveLocaly() { die('edit me'); $prod = new LL_Article_WImage(); $arr = $prod->getWhere("BaseArticleImageFile != ''"); echo count($arr); $min = 500; $max = 800; $point = array(100, 200, 300, 400, 500, 600, 700); foreach ($arr as $num => $atr) { // if($num<=$min)continue; // if($num>=$max)break; if (!in_array($num, $point)) { continue; } // pr($atr); $id = $atr->BaseArticleImageFile; $remoteImage = "http://43.231.128.129/LLProdImage/getImageJPG/" . $id; $img = _PHOTOPATH . "products/" . $id; echo $num . " . " . $img . "<br>"; // $ch = curl_init($remoteImage); // $fp = fopen($img, 'wb'); // curl_setopt($ch, CURLOPT_FILE, $fp); // curl_setopt($ch, CURLOPT_HEADER, 0); // curl_exec($ch); // curl_close($ch); // fclose($fp); if (file_put_contents($img, file_get_contents($remoteImage))) { echo $num . " . " . $id . "<br>"; } // break; } }
function articleWImage() { //$LL = new LL_Article; //$LL->printColumlistAsAttributes(); $ll = new LL_Article_WImage(); if ($_GET['truncate']) { $ll->truncate(); } $ean2 = new LL_Article_EAN(); if ($_GET['truncate']) { $ean2->truncate(); } // $url = "http://192.168.0.86:8180/goldwebapi/ecommerce/article"; //$url = "http://192.168.0.86:8880/goldwebapi/ecommerce/article"; $url = $this->ip_address . "GOLDEcomm/Article"; $data = file_get_contents($url); $data = json_decode($data, true); // Turns it into an array, change the last argument to false to make it an ob //pr($data); //pr($data); $counter = 0; $yangdisave = 0; $eandisave = 0; $eandicrawl = 0; foreach ($data as $ro) { $ll = new LL_Article_WImage(); $ll->fill($ro); pr($ll); if ($ll->save()) { // echo $ll->VariantID."<br>"; // echo $ll->VariantEAN."<br>"; $yangdisave++; //split EAN ke table EAN $split = explode(";", $ll->VariantEAN); foreach ($split as $ee) { $eandicrawl++; // echo "ean : ".$ee." "; $ean = new LL_Article_EAN(); $ean->ean_id = $ee; $ean->var_id = $ll->VariantID; if ($ean->save()) { $eandisave++; } else { echo "eanfailed " . $ee . " <br>"; } // echo "<br>"; } } else { echo "gagal " . $ll->VariantID . "<br>"; } $counter++; } echo "Jumlah yang di crawl : " . $counter . "<br>"; echo "Jumlah yang di save : " . $yangdisave . "<br>"; echo "Jumlah EAN yang di crawl : " . $eandicrawl . "<br>"; echo "Jumlah EAN yang di save : " . $eandisave . "<br>"; }
public function overwriteRead($return) { $return = parent::overwriteRead($return); $objs = $return['objs']; foreach ($objs as $obj) { if (isset($obj->testi_acc_id)) { $acc = new LL_Account(); $acc->getByID($obj->testi_acc_id); $obj->testi_acc_id = $acc->macc_first_name . " " . $acc->macc_last_name; } if (isset($obj->testi_product_id)) { $acc = new LL_Article_WImage(); $acc->getByID($obj->testi_product_id); $obj->testi_product_id = $acc->BaseArticleNameENG; } // if (isset($obj->testi_status)) { $obj->testi_status = $this->arrStatus[$obj->testi_status]; } } return $return; }
function pull() { $requestTime = $_GET['t']; $seconds = $requestTime / 1000; $seconds = $seconds - 300; $date = date("Y-m-d H:i:s", $seconds); $cart = new CartPortal(); $arr = $cart->getWhere("status > 0 AND date_created > '" . $date . "'"); // Filter. $exp = explode(",", $cart->crud_webservice_allowed); foreach ($arr as $o) { $sem = array(); $article = new LL_Article_WImage(); $article->getByID($o->variant_id); $sem['details'] = $article; foreach ($exp as $attr) { $sem[$attr] = stripslashes($o->{$attr}); } $json["results"][] = $sem; } $json["status_code"] = count($arr) > 0 ? 1 : 0; echo json_encode($json); }
public function get() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json['status_code'] = 1; $macc_id = addslashes($_GET['macc_id']); if (!$macc_id) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $llTesti = new LL_Wishlist(); $arrW = $llTesti->getWhereFromMultipleTable("wl_acc_id = '{$macc_id}' AND wl_articlenr = VariantID ORDER BY VariantNameINA ASC", array("LL_Article_WImage")); //pr($arrW); $llacc = new LL_Article_WImage(); //$llacc->VariantID $exp2 = explode(",", $llacc->crud_webservice_allowed); $arrPicsToAddPhotoUrl2 = $llacc->crud_add_photourl; $obj = $llTesti; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $json = array(); $json['status_code'] = 1; //$json['results_number'] = $obj->getJumlah($query); // $sudah = array(); //filter foreach ($arrW as $o) { if (in_array($o->VariantID, $sudah)) { continue; } $sudah[] = $o->VariantID; $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $o->{$attr}; } } foreach ($exp2 as $attr) { //if($attr == "macc_ll_customer_id")break; if (in_array($attr, $arrPicsToAddPhotoUrl2)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $o->{$attr}; } } //wImage //kalau base if ($o->ArticleType == 'Base') { $sem['base'] = $sem; } else { $arrID = $o->BaseArticleID; $arr2 = $llacc->getWhere("BaseArticleID = '{$arrID}' AND ArticleType = 'Base' LIMIT 0,1"); $base = $arr2[0]; $sem2 = array(); foreach ($exp2 as $attr2) { $sem2[$attr2] = $base->{$attr2}; } $sem['base'] = $sem2; } $json["results"][] = $sem; } if (count($arrW) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; }
public function getItems() { // $ids = addslashes($_GET['ids']); // if($ids==""){ // $json['status_code'] = 0; // $json['status_message'] = "ID Not Found"; // echo json_encode($json); // die(); // } // $exp = explode(",",$ids); // foreach($exp as $sss){ // $str[] = "ll__articletagging_with_base.TaggingLevel3ID = '$sss'"; // } // $imp = implode(" OR ",$str); $basetext = ""; if ($_GET['type'] == "base") { $basetext = "AND ll__article_with_image.ArticleType = 'Base'"; } $ll = new LL_ArticleTagging_wbase(); // $whereClause = "ll__articletagging_with_base.BaseArticleID = ll__article_with_image.BaseArticleID $basetext AND ( $imp )"; //echo $whereClause; $whereClause = "ll__articletagging_with_base.BaseArticleID = ll__article_with_image.BaseArticleID {$basetext} "; $arr = $ll->getWhereFromMultipleTable($whereClause, array("LL_Article_WImage"), "*"); //pr($arr); //$arr2 = $ll->getWhere("ll__articletagging.TaggingLevel3ID = '$id'"); //pr($arr2); $obj2 = new LL_Article_WImage(); $exp2 = explode(",", $obj2->crud_webservice_allowed); $obj = $ll; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $json = array(); $json['status_code'] = 1; //filter foreach ($arr as $o) { $sem = array(); foreach ($exp as $attr) { $sem[$attr] = $o->{$attr}; foreach ($exp2 as $attr2) { $sem[$attr2] = $o->{$attr2}; } } $json["results"][] = $sem; } if ($_GET['type'] == "base" && $_GET['getvar'] == 1) { $arrsem = array(); foreach ($json['results'] as $base) { $baseID = $base['BaseArticleID']; $arr5 = $obj2->getWhere("BaseArticleID = '{$baseID}'"); foreach ($arr5 as $o) { $sem = array(); foreach ($exp2 as $attr2) { $sem[$attr2] = $o->{$attr2}; } $base['variants'][] = $sem; } $arrsem[] = $base; } $json['results'] = $arrsem; } if (count($arr) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Elements Found"; } echo json_encode($json); die; }
public function scan() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $id = addslashes($_GET['id']); //$type = addslashes($_GET['type']); //if($id == "")die("no id"); if ($id == "" || $id < 1) { $json['status_code'] = 0; $json['status_message'] = "No ID"; echo json_encode($json); die; } $ean = new LL_Article_EAN(); $ean->getByID($id); if ($ean->var_id != "" && $ean->var_id > 0) { $ll = new LL_Article_WImage(); $ll->getByID($ean->var_id); // $arr = $ll->getWhere("VariantINACode = '$id' LIMIT 0,1"); // $sel = $arr[0]; if ($ll->BaseArticleID != "") { $sel = $ll; $json['status_code'] = 1; //isi yang asli $obj2 = new LL_Article_WImage(); $exp2 = explode(",", $obj2->crud_webservice_allowed); $sem = array(); foreach ($exp2 as $attr2) { $sem[$attr2] = $sel->{$attr2}; } $json['results'] = $sem; //biar tidak hitung ulang if ($sel->ArticleType == 'Base') { $json['base'] = $sem; } else { //isi base $arrID = $sel->BaseArticleID; $arr2 = $ll->getWhere("BaseArticleID = '{$arrID}' AND ArticleType = 'Base' LIMIT 0,1"); $base = $arr2[0]; $sem2 = array(); foreach ($exp2 as $attr2) { $sem2[$attr2] = $base->{$attr2}; } $json['base'] = $sem2; } echo json_encode($json); die; } else { $json['status_code'] = 0; $json['status_message'] = "No Results found"; echo json_encode($json); die; } } else { $json['status_code'] = 0; $json['status_message'] = "No Results found"; echo json_encode($json); die; } }