private function recursiveGetTree($model, $allowed_category_ids)
 {
     $params = [$this->route];
     $params += $this->current_selections;
     $params['category_group_id'] = $this->category_group_id;
     $params['last_category_id'] = $model->id;
     if (!isset($params['categories'])) {
         $params['categories'] = [];
     }
     $active = false;
     if (isset($this->current_selections['last_category_id'])) {
         $active = $this->current_selections['last_category_id'] == $model->id;
     }
     $result = ['label' => $model->name, 'url' => Url::to($params), 'items' => [], 'active' => in_array($model->id, $params['categories']) || $active, '_model' => &$model];
     if ($this->recursive === true) {
         $children = Category::getByParentId($model->id);
         foreach ($children as $child) {
             if ($this->onlyAvailableProducts === true && !in_array($child->id, $allowed_category_ids)) {
                 continue;
             }
             $result['items'][] = $this->recursiveGetTree($child, $allowed_category_ids);
         }
     }
     return $result;
 }
 /**
  * @inheritdoc
  * @return string
  */
 public function run()
 {
     $cacheKey = "PlainCategoriesWidget:" . $this->root_category_id . ":" . $this->viewFile;
     $result = Yii::$app->cache->get($cacheKey);
     if ($result === false) {
         $categories = Category::getByParentId($this->root_category_id);
         $result = $this->render($this->viewFile, ['categories' => $categories]);
         Yii::$app->cache->set($cacheKey, $result, 86400, new \yii\caching\TagDependency(['tags' => ActiveRecordHelper::getCommonTag(Category::className())]));
     }
     return $result;
 }