_slider_product.php
3 KB
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
<?php
use artbox\catalog\models\Product;
use noam148\imagemanager\components\ImageManagerGetPath;
use yii\helpers\Html;
use yii\web\View;
/**
* @var View $this
* @var Product $product
* @var ImageManagerGetPath $imageManager
*/
$imageManager = \Yii::$app->get('imagemanager');
?>
<div class="col-md-3 col-sm-6">
<div class="product">
<div class="image">
<?php
if (!empty( $product->images )) {
$image = $product->images[ 0 ]->id;
} else {
$image = null;
}
echo Html::a(
Html::img(
$image ? $imageManager->getImagePath($image) : '/no-image.png',
[
'class' => 'img-responsive-image1',
]
),
[
'product/view',
'id' => $product->id,
]
);
?>
</div>
<!-- /.image -->
<div class="text">
<h3>
<?php
echo Html::a(
$product->lang->title,
[
'product/view',
'id' => $product->id,
]
);
?>
</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;
?></p>
<p class="buttons">
<?php
echo Html::a(
Html::tag(
'i',
'',
[
'class' => 'fa fa-shopping-cart',
]
) . \Yii::t('app', 'В корзину'),
'#',
[ 'class' => 'btn btn-template-main' ]
);
?>
</p>
</div>
<!-- /.text -->
<?php
if ($product->is(1)) {
?>
<div class="ribbon new">
<div class="theribbon"><?php echo \Yii::t('app', 'Новое'); ?></div>
<div class="ribbon-background"></div>
</div>
<?php
}
if ($product->is(2)) {
?>
<div class="ribbon sale">
<div class="theribbon"><?php echo \Yii::t('app', 'Акция'); ?></div>
<div class="ribbon-background"></div>
</div>
<?php
}
?>
<!-- /.ribbon -->
</div>
<!-- /.product -->
</div>