Blame view

frontend/views/site/_slider_product.php 3.89 KB
950817c6   Alex Savenko   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  <?php
      use artbox\catalog\models\Product;
      use artbox\core\helpers\ImageHelper;
      use yii\helpers\Html;
      use yii\web\View;
      
      /**
       * @var View    $this
       * @var Product $product
       */
  ?>
  <div class="col-md-3 col-sm-6 slider-grid">
    <div class="product">
      <div class="image">
          <?php
              echo Html::a(
                  Html::img(
                      ImageHelper::set(
                          $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png'
                      )
                                 ->fillResize(260, 260)
                                 ->quality(85)
                                 ->render(),
                      [
                          'class' => 'img-responsive-image1',
                      ]
                  ),
                  [
                      'product/view',
                      'id'    => $product->id,
                      'alias' => $product->lang->alias,
                  ]
              );
          ?>
      </div>
      <!-- /.image -->
      <div class="text">
        <h3>
            <?php
                echo Html::a(
                    $product->lang->title,
                    [
                        'product/view',
                        'id'    => $product->id,
                        'alias' => $product->lang->alias,
                    ]
                );
            ?>
        </h3>
        <p class="price">
            <?php
                if ($product->variants[ 0 ]->price_old) {
                    echo Html::tag('del', $product->variants[ 0 ]->price_old . ' грн.');
                }
                echo ( $product->variants[ 0 ]->price ? : 0 ) . ' грн.';
            ?></p>
        <p class="buttons">
            <?php
                if ($product->variants[ 0 ]->canBuy()) {
                    echo Html::a(
                        Html::tag(
                            'i',
                            '',
                            [
                                'class' => 'fa fa-shopping-cart',
                            ]
                        ) . \Yii::t('app', 'В корзину'),
                        '#',
                        [
                            'class'   => 'btn btn-template-main add-to-basket',
                            'data-id' => $product->variants[ 0 ]->id,
                        ]
                    );
                } else {
                    echo Html::a(
                        \Yii::t('app', 'Нет в наличии'),
                        '#',
                        [
                            'class'   => 'btn btn-info disabled',
                            'data-id' => $product->variants[ 0 ]->id,
                        ]
                    );
                }
            ?>
        </p>
      </div>
      <!-- /.text -->
        <?php
        if($product->is('new') || $product->is('akcia') || $product->is('top')){
            ?>
            <div class="status_wrapp">
                <?php
                if ($product->is('new')) {
                    ?>
                    <div class="ribbon new">
                        <div class="theribbon"><?php echo \Yii::t('app', 'Новое'); ?></div>
                        <div class="ribbon-background"></div>
                    </div>
                    <?php
                }
                if ($product->is('akcia')) {
                    ?>
                    <div class="ribbon sale">
                        <div class="theribbon"><?php echo \Yii::t('app', 'Акция'); ?></div>
                        <div class="ribbon-background"></div>
                    </div>
                    <?php
                }
                if ($product->is('top')) {
                    ?>
                    <div class="ribbon top">
                        <div class="theribbon"><?php echo \Yii::t('app', 'Топ'); ?></div>
                        <div class="ribbon-background"></div>
                    </div>
                    <?php
                }
                ?>
            </div>
        <?php } ?>
  
  
  
      
      <!-- /.ribbon -->
    </div>
    <!-- /.product -->
  </div>