Commit 8c6aa8ad881366e220e999096252740baaa9983a
1 parent
102557ef
Корзина и миниатюры
Showing
4 changed files
with
307 additions
and
34 deletions
Show diff stats
frontend/views/basket/cart.php
@@ -9,19 +9,21 @@ | @@ -9,19 +9,21 @@ | ||
9 | ?> | 9 | ?> |
10 | <span class="badge"><?= $count; ?></span> | 10 | <span class="badge"><?= $count; ?></span> |
11 | <?php | 11 | <?php |
12 | - echo Html::a( | ||
13 | - Html::tag( | ||
14 | - 'span', | ||
15 | - \Yii::t('app', 'Корзина'), | ||
16 | - [ | ||
17 | - 'class' => 'sub-title', | ||
18 | - ] | ||
19 | - ), | 12 | +echo Html::a( |
13 | + Html::tag( | ||
14 | + 'span', | ||
15 | + \Yii::t('app', 'Корзина'), | ||
20 | [ | 16 | [ |
21 | - '/checkout/index', | ||
22 | - ], | ||
23 | - [ | ||
24 | - 'class' => 'cart-item-link', | 17 | + 'class' => 'sub-title', |
25 | ] | 18 | ] |
26 | - ); | 19 | + ), |
20 | + [ | ||
21 | + '#', | ||
22 | + ], | ||
23 | + [ | ||
24 | + 'class' => 'cart-item-link', | ||
25 | + 'data-toggle' => 'modal', | ||
26 | + 'data-target' => '#basket-modal', | ||
27 | + ] | ||
28 | +); | ||
27 | ?> | 29 | ?> |
frontend/views/layouts/main.php
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | * @var User $user | 6 | * @var User $user |
7 | */ | 7 | */ |
8 | use artbox\core\components\SeoComponent; | 8 | use artbox\core\components\SeoComponent; |
9 | + use artbox\core\helpers\ImageHelper; | ||
9 | use artbox\core\models\Feedback; | 10 | use artbox\core\models\Feedback; |
10 | use artbox\core\models\Image; | 11 | use artbox\core\models\Image; |
11 | use artbox\core\models\Page; | 12 | use artbox\core\models\Page; |
@@ -256,27 +257,29 @@ _________________________________________________________ --> | @@ -256,27 +257,29 @@ _________________________________________________________ --> | ||
256 | </ul> | 257 | </ul> |
257 | </div> | 258 | </div> |
258 | <!--/.nav-collapse --> | 259 | <!--/.nav-collapse --> |
259 | - | ||
260 | - <div class="cart-item" id="cart"> | ||
261 | - <span class="badge">0</span> | ||
262 | - <?php | ||
263 | - echo Html::a( | ||
264 | - Html::tag( | ||
265 | - 'span', | ||
266 | - \Yii::t('app', 'Корзина'), | ||
267 | - [ | ||
268 | - 'class' => 'sub-title', | ||
269 | - ] | ||
270 | - ), | ||
271 | - [ | ||
272 | - '/checkout/index', | ||
273 | - ], | ||
274 | - [ | ||
275 | - 'class' => 'cart-item-link', | ||
276 | - ] | ||
277 | - ); | ||
278 | - ?> | ||
279 | - </div> | 260 | + |
261 | + <div class="cart-item" id="cart"> | ||
262 | + <span class="badge">0</span> | ||
263 | + <?php | ||
264 | + echo Html::a( | ||
265 | + Html::tag( | ||
266 | + 'span', | ||
267 | + \Yii::t('app', 'Корзина'), | ||
268 | + [ | ||
269 | + 'class' => 'sub-title', | ||
270 | + ] | ||
271 | + ), | ||
272 | + [ | ||
273 | + '#', | ||
274 | + ], | ||
275 | + [ | ||
276 | + 'class' => 'cart-item-link', | ||
277 | + 'data-toggle' => 'modal', | ||
278 | + 'data-target' => '#basket-modal', | ||
279 | + ] | ||
280 | + ); | ||
281 | + ?> | ||
282 | + </div> | ||
280 | 283 | ||
281 | <div class="search-block" id="search"> | 284 | <div class="search-block" id="search"> |
282 | <?php | 285 | <?php |
@@ -518,6 +521,225 @@ _________________________________________________________ --> | @@ -518,6 +521,225 @@ _________________________________________________________ --> | ||
518 | </div> | 521 | </div> |
519 | </div> | 522 | </div> |
520 | <!-- *** FEEDBACK MODAL END *** --> | 523 | <!-- *** FEEDBACK MODAL END *** --> |
524 | + | ||
525 | + <!-- *** MODAL BASKET START *** --> | ||
526 | + | ||
527 | + <div class="modal fade" id="basket-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true"> | ||
528 | + <div class="modal-dialog modal-lg"> | ||
529 | + | ||
530 | + <div class="modal-content"> | ||
531 | + <div class="modal-header"> | ||
532 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
533 | + <h4 class="modal-title callback text-center" id="Login"> | ||
534 | + <?php | ||
535 | + echo Html::a( | ||
536 | + Html::tag( | ||
537 | + 'span', | ||
538 | + \Yii::t('app', 'Ваша корзина') | ||
539 | + ), | ||
540 | + [ | ||
541 | + '/checkout/index', | ||
542 | + ] | ||
543 | + ); | ||
544 | + ?> | ||
545 | + </h4> | ||
546 | + </div> | ||
547 | + <div class="modal-body"> | ||
548 | + <?php | ||
549 | + /** | ||
550 | + * @var \artbox\order\models\Basket $basket | ||
551 | + */ | ||
552 | + $basket = \Yii::$app->get('basket'); | ||
553 | + $data = $basket->getData(); | ||
554 | + $variants = []; | ||
555 | + if (!empty($data)) { | ||
556 | + $variants = $basket->findModels(array_keys($data)); | ||
557 | + } | ||
558 | + $formatter = \Yii::$app->formatter; | ||
559 | + $sum = 0; | ||
560 | + $sumDiscount = 0; | ||
561 | + foreach ($basket->findModels(array_keys($basket->getData())) as $variant) { | ||
562 | + $count = $basket->getItem($variant->id)[ 'count' ]; | ||
563 | + $sum += $variant->price * $count; | ||
564 | + if (!empty($variant->price_old)) { | ||
565 | + $sumDiscount += ( $variant->price_old - $variant->price ) * $count; | ||
566 | + } | ||
567 | + } | ||
568 | + | ||
569 | + if (!empty($variants)) { | ||
570 | + ?> | ||
571 | + <div class="clearfix"> | ||
572 | + <div class="col-md-12 clearfix"> | ||
573 | + <table class="table"> | ||
574 | + <thead> | ||
575 | + <tr> | ||
576 | + <th colspan="2"><?php echo \Yii::t('app', 'Продукт'); ?></th> | ||
577 | + <th><?php echo \Yii::t('app', 'Количество'); ?></th> | ||
578 | + <th><?php echo \Yii::t('app', 'Цена за единицу'); ?></th> | ||
579 | + <th><?php echo \Yii::t('app', 'Скидка'); ?></th> | ||
580 | + <th colspan="2"><?php echo \Yii::t('app', 'Всего'); ?></th> | ||
581 | + </tr> | ||
582 | + </thead> | ||
583 | + <tbody> | ||
584 | + <?php | ||
585 | + foreach ($variants as $variant) { | ||
586 | + $count = $basket->getItem($variant->id)[ 'count' ]; | ||
587 | + ?> | ||
588 | + <tr data-id="<?php echo $variant->id; ?>" class="product-row-basket"> | ||
589 | + <td> | ||
590 | + <?php | ||
591 | + echo Html::a( | ||
592 | + ImageHelper::set($variant->product->image->getPath()) | ||
593 | + ->fillResize(50, 50) | ||
594 | + ->renderImage( | ||
595 | + [ | ||
596 | + 'alt' => $variant->product->lang->title, | ||
597 | + 'title' => $variant->product->lang->title, | ||
598 | + ] | ||
599 | + ), | ||
600 | + [ | ||
601 | + '/product/view', | ||
602 | + 'id' => $variant->product->id, | ||
603 | + ], | ||
604 | + [ | ||
605 | + 'target' => '_blank', | ||
606 | + ] | ||
607 | + ); | ||
608 | + ?> | ||
609 | + </td> | ||
610 | + <td> | ||
611 | + <?php | ||
612 | + echo Html::a( | ||
613 | + $variant->product->lang->title, | ||
614 | + [ | ||
615 | + '/product/view', | ||
616 | + 'id' => $variant->product->id, | ||
617 | + ], | ||
618 | + [ | ||
619 | + 'target' => '_blank', | ||
620 | + ] | ||
621 | + ); | ||
622 | + ?> | ||
623 | + </td> | ||
624 | + <td> | ||
625 | + <?php | ||
626 | + echo Html::input( | ||
627 | + 'number', | ||
628 | + '', | ||
629 | + $count, | ||
630 | + [ | ||
631 | + 'class' => 'form-control increase-product-basket', | ||
632 | + ] | ||
633 | + ); | ||
634 | + ?> | ||
635 | + </td> | ||
636 | + <td> | ||
637 | + <?php | ||
638 | + echo $formatter->asDecimal($variant->price ? : 0, 2); | ||
639 | + ?> | ||
640 | + </td> | ||
641 | + <td> | ||
642 | + <?php | ||
643 | + if (!empty($variant->price_old)) { | ||
644 | + echo $formatter->asDecimal($variant->price_old - $variant->price, 2); | ||
645 | + } else { | ||
646 | + echo $formatter->asDecimal(0, 2); | ||
647 | + } | ||
648 | + ?> | ||
649 | + </td> | ||
650 | + <td> | ||
651 | + <?php | ||
652 | + echo $formatter->asDecimal( | ||
653 | + ( $variant->price ? : 0 ) * $count, | ||
654 | + 2 | ||
655 | + ); | ||
656 | + ?> | ||
657 | + </td> | ||
658 | + <td><a href="#" class="remove-product-cart"><i class="fa fa-trash-o"></i></a> | ||
659 | + </td> | ||
660 | + </tr> | ||
661 | + <?php | ||
662 | + } | ||
663 | + ?> | ||
664 | + </tbody> | ||
665 | + <tfoot> | ||
666 | + <tr> | ||
667 | + <th colspan="5"><?php echo \Yii::t('app', 'Всего'); ?></th> | ||
668 | + <th colspan="2"><?php echo $formatter->asDecimal($sum, 2); ?></th> | ||
669 | + </tr> | ||
670 | + </tfoot> | ||
671 | + </table> | ||
672 | + </div> | ||
673 | + <div class="col-md-12 clearfix"> | ||
674 | + <div class="box" id="order-summary"> | ||
675 | + <div class="box-header"> | ||
676 | + <h3>Итоговый счет</h3> | ||
677 | + </div> | ||
678 | + <p class="text-muted small"><?php echo \Yii::t( | ||
679 | + 'app', | ||
680 | + 'Стоимость доставки рассчитывается в зависимости от адреса и способа доставки' | ||
681 | + ); ?></p> | ||
682 | + | ||
683 | + <div class="table-responsive"> | ||
684 | + <table class="table"> | ||
685 | + <tbody> | ||
686 | + <tr> | ||
687 | + <td><?php echo \Yii::t('app', 'Всего за товары'); ?></td> | ||
688 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | ||
689 | + </tr> | ||
690 | + <tr> | ||
691 | + <td><?php echo \Yii::t('app', 'Сумма скидки'); ?></td> | ||
692 | + <th><?php echo $formatter->asDecimal($sumDiscount, 2); ?></th> | ||
693 | + </tr> | ||
694 | + <tr class="total"> | ||
695 | + <td><?php echo \Yii::t('app', 'Итого к оплате'); ?></td> | ||
696 | + <th><?php echo $formatter->asDecimal($sum, 2); ?></th> | ||
697 | + </tr> | ||
698 | + </tbody> | ||
699 | + </table> | ||
700 | + </div> | ||
701 | + </div> | ||
702 | + </div> | ||
703 | + <div class="col-md-12 clearfix"> | ||
704 | + | ||
705 | + <div class="box"> | ||
706 | + | ||
707 | + <div class="table-responsive"> | ||
708 | + | ||
709 | + | ||
710 | + </div> | ||
711 | + <!-- /.table-responsive --> | ||
712 | + | ||
713 | + <div class="box-footer"> | ||
714 | + <div class="pull-right"> | ||
715 | + <?php | ||
716 | + echo Html::a( | ||
717 | + \Yii::t( | ||
718 | + 'app', | ||
719 | + ' Оформить заказ ' | ||
720 | + ) . Html::icon('chevron-right', [ 'prefix' => 'fa fa-' ]), | ||
721 | + [ 'checkout/info' ], | ||
722 | + [ | ||
723 | + 'class' => 'btn btn-success', | ||
724 | + ] | ||
725 | + ) | ||
726 | + ?> | ||
727 | + </div> | ||
728 | + </div> | ||
729 | + </div> | ||
730 | + | ||
731 | + </div> | ||
732 | + </div> | ||
733 | + <?php | ||
734 | + } else { | ||
735 | + echo Html::tag('p', \Yii::t('app', 'Ваша корзина пуста!')); | ||
736 | + } | ||
737 | + ?> | ||
738 | + </div> | ||
739 | + </div> | ||
740 | + </div> | ||
741 | + </div> | ||
742 | + <!-- *** MODAL BASKET END *** --> | ||
521 | <?php | 743 | <?php |
522 | if (!$isHome) { | 744 | if (!$isHome) { |
523 | ?> | 745 | ?> |
frontend/views/site/_slider_product.php
@@ -31,6 +31,37 @@ | @@ -31,6 +31,37 @@ | ||
31 | ); | 31 | ); |
32 | ?> | 32 | ?> |
33 | </div> | 33 | </div> |
34 | + | ||
35 | + <div class="vcovers"> | ||
36 | + <?php | ||
37 | + $qwe = 0; | ||
38 | + while($qwe < 5){?> | ||
39 | + | ||
40 | + <div class="vcover"> | ||
41 | + <?php | ||
42 | + echo Html::a( | ||
43 | + Html::img( | ||
44 | + ImageHelper::set( | ||
45 | + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png' | ||
46 | + ) | ||
47 | + ->fillResize(40, 40) | ||
48 | + ->render(), | ||
49 | + [ | ||
50 | + 'class' => 'img-responsive-image1', | ||
51 | + ] | ||
52 | + ), | ||
53 | + [ | ||
54 | + 'product/view', | ||
55 | + 'id' => $product->id, | ||
56 | + ] | ||
57 | + ); | ||
58 | + ?> | ||
59 | + </div> | ||
60 | + <?php | ||
61 | + $qwe++; | ||
62 | + } | ||
63 | + ?> | ||
64 | + </div> | ||
34 | <!-- /.image --> | 65 | <!-- /.image --> |
35 | <div class="text"> | 66 | <div class="text"> |
36 | <h3> | 67 | <h3> |
frontend/web/css/style.css
@@ -4731,4 +4731,22 @@ a i.fa, button i.fa, span.fa { | @@ -4731,4 +4731,22 @@ a i.fa, button i.fa, span.fa { | ||
4731 | 4731 | ||
4732 | .box .btn.btn-template-main { | 4732 | .box .btn.btn-template-main { |
4733 | margin-bottom: 5px; | 4733 | margin-bottom: 5px; |
4734 | +} | ||
4735 | + | ||
4736 | +.vcovers { | ||
4737 | + position: absolute; | ||
4738 | + top: 0; | ||
4739 | + right: 20px; | ||
4740 | + height: 260px; | ||
4741 | + overflow: hidden; | ||
4742 | +} | ||
4743 | + | ||
4744 | +.vcovers .vcover img.img-responsive-image1 { | ||
4745 | + border: 1px solid #eeeeee; | ||
4746 | + margin: 5px 0px; | ||
4747 | + transition:0.2s; | ||
4748 | +} | ||
4749 | + | ||
4750 | +.vcovers .vcover img:hover{ | ||
4751 | + border: 1px solid rgb(0, 91, 172); | ||
4734 | } | 4752 | } |
4735 | \ No newline at end of file | 4753 | \ No newline at end of file |