| @@ 471-473 (lines=3) @@ | ||
| 468 | { |
|
| 469 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 470 | $query = Product::find()->orderBy('sort_order'); |
|
| 471 | foreach (['name', 'content'] as $attribute) { |
|
| 472 | $query->orWhere(['like', $attribute, $term]); |
|
| 473 | } |
|
| 474 | $products = $query->limit(20)->all(); |
|
| 475 | $result = []; |
|
| 476 | /** @var Product $product */ |
|
| @@ 70-72 (lines=3) @@ | ||
| 67 | $query = Product::find() |
|
| 68 | ->select(['id', 'name', 'main_category_id', 'slug', 'sku']) |
|
| 69 | ->orderBy(['sort_order' => SORT_ASC, 'id' => SORT_DESC]); |
|
| 70 | foreach (['name', 'content', 'sku'] as $attribute) { |
|
| 71 | $query->orWhere(['like', $attribute, $term]); |
|
| 72 | } |
|
| 73 | $query->andWhere(['active'=>1]); |
|
| 74 | $products = $query->limit(Yii::$app->getModule('core')->autoCompleteResultsCount)->all(); |
|
| 75 | $result = []; |
|