public function actionAddParam($id = null, $languageId = null)
    {
        if (\Yii::$app->user->can('updateProduct', ['productOwner' => Product::findOne($id)->owner])) {
            $param = new Param();
            $param->product_id = $id;
            $param_translation = new ParamTranslation();
            $param_translation->language_id = $languageId;

            if (Yii::$app->request->isPost) {

                $param->load(Yii::$app->request->post());
                $param_translation->load(Yii::$app->request->post());
                if ($param->validate() && $param_translation->validate()) {
                    $param->save();
                    $param_translation->param_id = $param->id;
                    $param_translation->language_id = $languageId;
                    $param_translation->save();

                    $this->trigger(self::EVENT_AFTER_EDIT_PRODUCT, new ProductEvent([
                        'id' => $param->product_id
                    ]));

                    Yii::$app->getSession()->setFlash('success', 'Data were successfully modified.');
                } else
                    Yii::$app->getSession()->setFlash('danger', 'Failed to change the record.');
            }

            $languages = Language::find()->all();
            $languageIndex = 0;
            foreach ($languages as $key => $language) {
                if ($language->id == $languageId) {
                    $languageIndex = $key;
                    break;
                }
            }

            return $this->render('../product/save', [
                'viewName' => '../product-param/add-param',
                'selectedLanguage' => Language::findOne($languageId),
                'product' => Product::findOne($id),
                'languages' => Language::find()->all(),

                'params' => [
                    'params' => Param::find()->where([
                        'product_id' => $id,
                    ])->orderBy('position')->all(),
                    'param_translation' => new ParamTranslation(),
                    'productId' => $id,
                    'languageId' => $languageId,
                    'languageIndex' => $languageIndex
                ]
            ]);
        } else throw new ForbiddenHttpException(\Yii::t('shop', 'You have not permission to do this action.'));
    }