| Conditions | 2 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public static function editQuery(SearchEvent $event) |
||
| 11 | { |
||
| 12 | /** @var \app\modules\shop\ShopModule $module */ |
||
| 13 | $module = \Yii::$app->modules['shop']; |
||
| 14 | |||
| 15 | $event->activeQuery->select('`id`') |
||
| 16 | ->from(Product::tableName()) |
||
| 17 | ->orWhere('`name` LIKE :q') |
||
| 18 | ->orWhere('`h1` LIKE :q') |
||
| 19 | ->orWhere('`content` LIKE :q') |
||
| 20 | ->orWhere('`sku` LIKE :q') |
||
| 21 | ->addParams([':q' => '%' . $event->q . '%']) |
||
| 22 | ->andWhere( |
||
| 23 | [ |
||
| 24 | 'active' => 1, |
||
| 25 | ] |
||
| 26 | ); |
||
| 27 | if ($module->allowSearchGeneratedProducts != 1) { |
||
| 28 | $event->activeQuery->andWhere( |
||
| 29 | [ |
||
| 30 | 'parent_id' => 0 |
||
| 31 | ] |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |