コード例 #1
0
 public function actionDestinationSave()
 {
     $id = Yii::$app->request->get('id');
     $model = null;
     if (!empty($id)) {
         $model = UserShippingAddress::findOne($id);
     }
     if (is_null($model)) {
         $model = new UserShippingAddress();
     }
     $model->user_id = $this->getLoggedUser()->id;
     if ($model->load(Yii::$app->request->get()) && $model->save()) {
         $this->getShoppingCart()->destination = $model->id;
         $model = null;
     }
     return $this->renderPartial('_sc_destination', ['model' => $model]);
 }