Пример #1
0
 /**
  * getproducts endpoint - multiple SKU getProduct
  */
 protected function getproducts($args)
 {
     $sku = $_GET["sku"];
     if (PowaTagAPI::requestLog()) {
         PowaTagLogs::initRequestLog('Process get multiple products', PowaTagLogs::SUCCESS, $sku);
     }
     if ($sku == '') {
         return PowaTagAPI::powaError(array('error' => PowaTagErrorType::$SKU_NOT_FOUND, 'message' => "Missing SKU value"));
     }
     $asku = explode(",", $sku);
     $reply = array();
     foreach ($asku as $idProduct) {
         $stdClass = new stdClass();
         $stdClass->id_product = $idProduct;
         $powatagProduct = new PowaTagProduct($stdClass);
         $detail = $powatagProduct->setJSONRequest();
         if ($detail === false) {
             $detail = array("code" => $idProduct, "availability" => "false");
         } else {
             $detail["availability"] = "true";
         }
         $reply[] = $detail;
     }
     return array("products" => $reply);
 }