From: Alexander Smirnov Date: Tue, 7 May 2024 08:48:12 +0000 (+0300) Subject: item item site X-Git-Tag: 1.1~47^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=2001e9d9ac38defafad9eb6517a47682d75699c2;p=erp24_rep%2Fyii-erp24%2F.git item item site --- diff --git a/erp24/api3/modules/v1/controllers/search/ItemController.php b/erp24/api3/modules/v1/controllers/search/ItemController.php new file mode 100644 index 00000000..38fa83b7 --- /dev/null +++ b/erp24/api3/modules/v1/controllers/search/ItemController.php @@ -0,0 +1,30 @@ +select(['id', 'name'])->where(['tip' => 'products_group'])->all(); + + $parent = ArrayHelper::map($products, 'id', 'name'); + + $products2 = Products1c::find()->select('id')->where(['tip' => 'products_group'])->andWhere(['LIKE', 'name', '%категории А%', false])->all(); + + $no = ArrayHelper::getColumn($products2, 'id'); + + $products3 = Products1c::find()->select(['id', 'parent_id', 'name'])->where(['tip' => 'products'])->andWhere(['view' => '1']) + ->andWhere(['NOT IN', 'parent_id', $no])->andWhere(['LIKE', 'name', '%' . $name . '%', false])->orderBy(['name' => SORT_ASC]) + ->limit($limit)->asArray()->all(); + + foreach($products3 as $row) { + $p[]=[$row["id"],"".$row["name"]." (".$parent[$row["parent_id"]].")"]; + } + + return $p; + } +} \ No newline at end of file