/**
  * Creates a new GoodsParams model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new GoodsParams();
     $arPost = Yii::$app->request->post();
     if (Yii::$app->request->getIsPost()) {
         $arPost['GoodsParams']['goods_params_name_id'] = $this->oGoodsParamsName->id;
         if (!$this->oGoodsParamsName->parent_param) {
             $arPost['GoodsParams']['link_category'] = 0;
         }
     }
     if (Yii::$app->request->getIsPost() && $model->load($arPost) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         $listTypesParams = ['' => ' - - '];
         $parentParam = GoodsParams::find()->where('goods_params_name_id=:parent_param', [':parent_param' => $this->oGoodsParamsName->parent_param])->all();
         $arParams = ['' => ' - - '];
         //            print ('<pre>');print_r($parentParam);print('</pre>');exit('100');
         foreach ($parentParam as $value) {
             $arParams[$value->id] = $value->value;
         }
         return $this->render('create', ['model' => $model, 'arParams' => $arParams]);
     }
 }