Fur coat with very but very very long name
+143.00
+ +diff --git a/frontend/controllers/AccountController.php b/frontend/controllers/AccountController.php index 1a25d20..d8aacea 100644 --- a/frontend/controllers/AccountController.php +++ b/frontend/controllers/AccountController.php @@ -4,6 +4,7 @@ use artbox\order\models\Customer; use artbox\order\models\Order; + use artbox\order\models\PasswordForm; use yii\web\Controller; use yii\web\ForbiddenHttpException; use yii\web\NotFoundHttpException; @@ -47,19 +48,74 @@ * @var Order $order */ $order = Order::find() - ->with('orderProducts') + ->with('orderProducts.variant.product.lang') ->where( [ 'id' => $id, ] ) ->one(); - + if (empty($order)) { throw new NotFoundHttpException(\Yii::t('app', 'Order not found')); } elseif ($order->user_id !== \Yii::$app->user->identity->getId()) { throw new ForbiddenHttpException(); } + + return $this->render( + 'order', + [ + 'order' => $order, + ] + ); + } + + public function actionAccount() + { + return $this->render( + 'account', + [ + 'passwordModel' => new PasswordForm(), + ] + ); + } + + public function actionChangePassword() + { + /** + * @var Customer $modeluser + */ + $model = new PasswordForm(); + $modeluser = \Yii::$app->user->identity; + if ($model->load(\Yii::$app->request->post())) { + if ($model->validate()) { + $modeluser->setPassword($model->newpass); + if ($modeluser->save()) { + return $this->redirect([ 'index' ]); + } else { + return $this->render( + 'account', + [ + 'passwordModel' => $model, + ] + ); + } + } else { + return $this->render( + 'account', + [ + 'passwordModel' => $model, + ] + ); + } + } else { + return $this->render( + 'account', + [ + 'passwordModel' => $model, + ] + ); + } } } \ No newline at end of file diff --git a/frontend/models/Order.php b/frontend/models/Order.php index e0333cc..1af6082 100644 --- a/frontend/models/Order.php +++ b/frontend/models/Order.php @@ -50,13 +50,13 @@ public function behaviors() { - return [ - [ - 'class' => BlameableBehavior::className(), - 'createdByAttribute' => 'user_id', - 'updatedByAttribute' => false, - ], + $behaviors = parent::behaviors(); + $behaviors[] = [ + 'class' => BlameableBehavior::className(), + 'createdByAttribute' => 'user_id', + 'updatedByAttribute' => false, ]; + return $behaviors; } /** diff --git a/frontend/views/account/_menu.php b/frontend/views/account/_menu.php new file mode 100644 index 0000000..58c3206 --- /dev/null +++ b/frontend/views/account/_menu.php @@ -0,0 +1,49 @@ + + +
diff --git a/frontend/views/account/account.php b/frontend/views/account/account.php new file mode 100644 index 0000000..b60d7d5 --- /dev/null +++ b/frontend/views/account/account.php @@ -0,0 +1,185 @@ +params[ 'breadcrumbs' ][] = \Yii::t('app', 'Мой аккаунт'); + +?> + +Измените ваши персональные данные или пароль здесь.
+ +Order #= $order->id ?> was placed on = date( + 'd.m.Y', + $order->created_at + ) ?>label)) { + ?> and is currently + = $order->label->lang->title ?>.
+If you have any questions, please feel free to + contact us, our customer service center is working for you 24/7.
+ +Product | +Quantity | +Unit price | +Total | +|
---|---|---|---|---|
+ + = ImageHelper::set( + $product->variant ? $product->variant->product->image->getPath( + ) : '@frontend/web/img/no-image.png' + ) + ->cropResize(50, 50) + ->renderImage( + [ + 'alt' => $product->variant->product->lang->title, + ] + ) ?> + + | += $product->variant->product->lang->title ?> + | += $product->count ?> | += $product->price ?> | += $product->count * $product->price ?> | +
Total | += $total ?> | +
= $order->name ?>
+
= $order->phone ?>
+
= $order->city ?>
+
= $order->address ?>
+
= $order->payment->lang->title ?>
+
= $order->delivery->lang->title ?>
143.00
+ +143.00
+ + +143.00
+ + +