Commit f3137bc12af58e4b50457d73a2d377ae44e74080

Authored by Volodymyr
1 parent ae2e9ad0

product fix

Showing 1 changed file with 28 additions and 0 deletions   Show diff stats
backend/controllers/ProductController.php
... ... @@ -11,6 +11,34 @@ use yii\web\NotFoundHttpException;
11 11 class ProductController extends Controller
12 12 {
13 13 /**
  14 + * Updates an existing Product model.
  15 + * If update is successful, the browser will be redirected to the 'view' page.
  16 + * @param integer $id
  17 + * @return mixed
  18 + */
  19 + public function actionUpdate($id)
  20 + {
  21 + $model = $this->findModel($id);
  22 + $model->generateLangs();
  23 +
  24 + if ($model->loadWithLangs(\Yii::$app->request)) {
  25 +
  26 + if ($model->saveWithLangs()) {
  27 +
  28 + return $this->redirect(
  29 + [
  30 + 'view',
  31 + 'id' => $model->id,
  32 + ]
  33 + );
  34 + }
  35 + }
  36 + return $this->render('update', [
  37 + 'model' => $model,
  38 + 'modelLangs' => $model->modelLangs,
  39 + ]);
  40 + }
  41 + /**
14 42 * Lists all Tile models.
15 43 * @return mixed
16 44 */
... ...