public function actionShow(int $id)
    {

        $this->trigger(self::EVENT_BEFORE_SHOW, $this->getViewedProductEvent($id));

        $product = Product::find()
            ->where(['show' => true, 'id' => $id, 'status' => Product::STATUS_SUCCESS])
            ->one();

        if (!empty($product)) {

            $this->setSeoData($product);

            $this->trigger(self::EVENT_AFTER_SHOW);

            return $this->render('show', [
                'product' => $product,
                'cart' => new CartForm(),
                'defaultCombination' => Combination::find()->where([
                    'product_id' => $id,
                    'default' => true
                ])->one()
            ]);
        } else throw new NotFoundHttpException();
    }
public function actionShow(int $id)
    {

        $this->trigger(self::EVENT_BEFORE_SHOW, $this->getViewedProductEvent($id));

        $product = Product::find()
            ->where(['show' => true, 'id' => $id, 'status' => Product::STATUS_SUCCESS])
            ->one();

        if (!empty($product)) {

            $this->setSeoData($product);

            $this->trigger(self::EVENT_AFTER_SHOW);

            return $this->render('show', [
                'product' => $product,
                'cart' => new CartForm(),
                'defaultCombination' => Combination::find()->where([
                    'product_id' => $id,
                    'default' => true
                ])->one()
            ]);
        } else throw new NotFoundHttpException();
    }
public function actionShow ( int $ id ) { $ this -> trigger ( self :: EVENT_BEFORE_SHOW , $ this -> getViewedProductEvent ( $ id ) ) ; $ product = Product :: find ( ) -> where ( [ 'show' => true , 'id' => $ id , 'status' => Product :: STATUS_SUCCESS ] ) -> one ( ) ; if ( ! empty ( $ product ) ) { $ this -> setSeoData ( $ product ) ; $ this -> trigger ( self :: EVENT_AFTER_SHOW ) ; return $ this -> render ( 'show' , [ 'product' => $ product , 'cart' => new CartForm ( ) , 'defaultCombination' => Combination :: find ( ) -> where ( [ 'product_id' => $ id , 'default' => true ] ) -> one ( ) ] ) ; } else throw new NotFoundHttpException ( ) ; }
Shows Product model

@param integer $id
@return string
@throws NotFoundHttpException
Shows Product model