products = $products; } public function init(){ parent::init(); $this->count = $this->count != null ? $this->count : 3; } public function run(): string { if (Yii::$app->settings->data['shop']['bestsellers_type'] == 'random') { $products = Product::find()->active()->bestseller()->limit($this->count)->all(); } else { $ids = Json::decode(Yii::$app->settings->data['shop']['bestsellers_products']); $products = $this->products->findMany($ids); } return $this->render('sidebar-bestsellers', [ 'products' => $products, ]); } }