Commit e67c95f93bdff9136166da20fcdbeabe03948027
1 parent
c8dead94
Fast buy
Showing
4 changed files
with
43 additions
and
29 deletions
Show diff stats
frontend/controllers/CheckoutController.php
@@ -165,6 +165,13 @@ | @@ -165,6 +165,13 @@ | ||
165 | } | 165 | } |
166 | \Yii::$app->session->remove('order'); | 166 | \Yii::$app->session->remove('order'); |
167 | $basket->clear(); | 167 | $basket->clear(); |
168 | + \Yii::$app->session->setFlash( | ||
169 | + 'success', | ||
170 | + \Yii::t( | ||
171 | + 'app', | ||
172 | + 'Заказ успешно оформлен. Ваш номер заказ: ' . $model->id . '.' | ||
173 | + ) | ||
174 | + ); | ||
168 | return $this->redirect([ 'site/index' ]); | 175 | return $this->redirect([ 'site/index' ]); |
169 | } | 176 | } |
170 | return $this->render( | 177 | return $this->render( |
frontend/models/Order.php
@@ -60,7 +60,6 @@ | @@ -60,7 +60,6 @@ | ||
60 | 'email', | 60 | 'email', |
61 | 'delivery_id', | 61 | 'delivery_id', |
62 | 'payment_id', | 62 | 'payment_id', |
63 | - 'variantId', | ||
64 | ], | 63 | ], |
65 | 'required', | 64 | 'required', |
66 | ], | 65 | ], |
@@ -106,7 +105,7 @@ | @@ -106,7 +105,7 @@ | ||
106 | ], | 105 | ], |
107 | [ | 106 | [ |
108 | [ | 107 | [ |
109 | - 'variant_id', | 108 | + 'variantId', |
110 | ], | 109 | ], |
111 | 'exist', | 110 | 'exist', |
112 | 'targetClass' => Variant::className(), | 111 | 'targetClass' => Variant::className(), |
@@ -131,6 +130,14 @@ | @@ -131,6 +130,14 @@ | ||
131 | ] | 130 | ] |
132 | ); | 131 | ); |
133 | }, | 132 | }, |
133 | + 'on' => self::SCENARIO_FAST, | ||
134 | + ], | ||
135 | + [ | ||
136 | + [ | ||
137 | + 'variantId', | ||
138 | + ], | ||
139 | + 'required', | ||
140 | + 'on' => self::SCENARIO_FAST, | ||
134 | ], | 141 | ], |
135 | ]; | 142 | ]; |
136 | } | 143 | } |
frontend/views/layouts/main.php
@@ -348,7 +348,7 @@ _________________________________________________________ --> | @@ -348,7 +348,7 @@ _________________________________________________________ --> | ||
348 | ?> | 348 | ?> |
349 | <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true"> | 349 | <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true"> |
350 | <div class="modal-dialog modal-sm"> | 350 | <div class="modal-dialog modal-sm"> |
351 | - | 351 | + |
352 | <div class="modal-content"> | 352 | <div class="modal-content"> |
353 | <div class="modal-header"> | 353 | <div class="modal-header"> |
354 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | 354 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
@@ -404,7 +404,7 @@ _________________________________________________________ --> | @@ -404,7 +404,7 @@ _________________________________________________________ --> | ||
404 | ); | 404 | ); |
405 | ?> | 405 | ?> |
406 | </p> | 406 | </p> |
407 | - | 407 | + |
408 | </div> | 408 | </div> |
409 | </div> | 409 | </div> |
410 | </div> | 410 | </div> |
@@ -414,34 +414,31 @@ _________________________________________________________ --> | @@ -414,34 +414,31 @@ _________________________________________________________ --> | ||
414 | ?> | 414 | ?> |
415 | 415 | ||
416 | <!-- *** LOGIN MODAL END *** --> | 416 | <!-- *** LOGIN MODAL END *** --> |
417 | - | ||
418 | - | ||
419 | - <!-- *** SUCCESS MODAL BEGIN *** | ||
420 | - _________________________________________________________ --> | ||
421 | - <div class="modal fade" id="success-modal" tabindex="-1" role="dialog" aria-labelledby="Success" aria-hidden="true"> | 417 | + |
418 | + | ||
419 | + <!-- *** SUCCESS MODAL BEGIN *** | ||
420 | +_________________________________________________________ --> | ||
421 | + <?php | ||
422 | + if ($msg = \Yii::$app->session->getFlash('success')) { | ||
423 | + ?> | ||
424 | + <div class="modal fade" id="success-modal" tabindex="-1" role="dialog" aria-labelledby="Success" aria-hidden="true"> | ||
422 | <div class="modal-dialog modal-sm"> | 425 | <div class="modal-dialog modal-sm"> |
423 | - | ||
424 | - <div class="modal-content"> | ||
425 | - <div class="modal-header"> | ||
426 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
427 | - <h4 class="modal-title" id="Success"> | ||
428 | - Success Title | ||
429 | - </h4> | ||
430 | - </div> | ||
431 | - <div class="modal-body"> | ||
432 | - <p class="text-center text-muted"> | ||
433 | - Success text 1</p> | ||
434 | - <p class="text-center text-muted"> | ||
435 | - Success text 2 | ||
436 | - </p> | ||
437 | - | ||
438 | - </div> | 426 | + |
427 | + <div class="modal-content"> | ||
428 | + <div class="modal-header"> | ||
429 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
439 | </div> | 430 | </div> |
431 | + <div class="modal-body"> | ||
432 | + <?php echo $msg; ?> | ||
433 | + </div> | ||
434 | + </div> | ||
440 | </div> | 435 | </div> |
441 | - </div> | ||
442 | - | ||
443 | - <!-- *** SUCCESS MODAL END *** --> | ||
444 | - | 436 | + </div> |
437 | + <?php | ||
438 | + $this->registerJs("$('#success-modal').modal('show');"); | ||
439 | + } | ||
440 | + ?> | ||
441 | + | ||
445 | <!-- *** Breadcrumbs *** --> | 442 | <!-- *** Breadcrumbs *** --> |
446 | <?php | 443 | <?php |
447 | if (!$isHome) { | 444 | if (!$isHome) { |
frontend/widgets/LangLink.php
@@ -29,6 +29,9 @@ | @@ -29,6 +29,9 @@ | ||
29 | ->indexBy('id') | 29 | ->indexBy('id') |
30 | ->column(); | 30 | ->column(); |
31 | } | 31 | } |
32 | + if (count($this->languageIds) < 2) { | ||
33 | + return; | ||
34 | + } | ||
32 | foreach ($this->languageIds as $languageId => $url) { | 35 | foreach ($this->languageIds as $languageId => $url) { |
33 | if (Language::getCurrent()->id !== $languageId) { | 36 | if (Language::getCurrent()->id !== $languageId) { |
34 | if (\Yii::$app->requestedRoute == 'category/view') { | 37 | if (\Yii::$app->requestedRoute == 'category/view') { |