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
|
<?php
/**
* @var \yii\web\View $this
* @var \artbox\order\models\Basket $basket
* @var \artbox\catalog\models\Variant[] $variants
* @var \artbox\catalog\models\Product[] $topItems
*/
use artbox\core\helpers\ImageHelper;
use yii\bootstrap\Html;
$formatter = \Yii::$app->formatter;
$sum = 0;
$sumDiscount = 0;
foreach ($variants as $variant) {
$count = $basket->getItem($variant->id)[ 'count' ];
$sum += $variant->price * $count;
if (!empty($variant->price_old)) {
$sumDiscount += ( $variant->price_old - $variant->price ) * $count;
}
}
?>
<div id="content">
<div class="container">
<div class="row">
<div id="basket" class="col-xs-12 basket-container clearfix">
<?php
if (!empty($variants)) {
?>
<div class="row">
<div class="col-md-9 clearfix">
<h1><?php echo \Yii::t('app', 'Ваша корзина'); ?></h1>
<div class="box">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th colspan="2"><?php echo \Yii::t('app', 'Продукт'); ?></th>
|
e226698d
mzavalniuk
translate shop pa...
|
40
41
42
43
|
<th><?php echo \Yii::t('app', 'Кількість'); ?></th>
<th><?php echo \Yii::t('app', 'Ціна за одиницю'); ?></th>
<th><?php echo \Yii::t('app', 'Знижка'); ?></th>
<th colspan="2"><?php echo \Yii::t('app', 'Всього'); ?></th>
|
950817c6
Alex Savenko
first commit
|
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
128
129
|
</tr>
</thead>
<tbody>
<?php
foreach ($variants as $variant) {
$count = $basket->getItem($variant->id)[ 'count' ];
?>
<tr data-id="<?php echo $variant->id; ?>" class="product-row-basket">
<td>
<?php
echo Html::a(
ImageHelper::set($variant->product->image->getPath())
->fillResize(50, 50)
->renderImage(
[
'alt' => $variant->product->lang->title,
'title' => $variant->product->lang->title,
]
),
[
'/product/view',
'id' => $variant->product->id,
],
[
'target' => '_blank',
]
);
?>
</td>
<td>
<?php
echo Html::a(
$variant->product->lang->title,
[
'/product/view',
'id' => $variant->product->id,
],
[
'target' => '_blank',
]
);
?>
</td>
<td>
<?php
echo Html::input(
'number',
'',
$count,
[
'class' => 'form-control increase-product-basket',
]
);
?>
</td>
<td>
<?php
echo $formatter->asDecimal($variant->price ? : 0, 2);
?>
</td>
<td>
<?php
if (!empty($variant->price_old)) {
echo $formatter->asDecimal($variant->price_old - $variant->price, 2);
} else {
echo $formatter->asDecimal(0, 2);
}
?>
</td>
<td>
<?php
echo $formatter->asDecimal(
( $variant->price ? : 0 ) * $count,
2
);
?>
</td>
<td><a href="#" class="remove-product-cart"><i class="fa fa-trash-o"></i></a>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
|
e226698d
mzavalniuk
translate shop pa...
|
130
|
<th colspan="5"><?php echo \Yii::t('app', 'Всього'); ?></th>
|
950817c6
Alex Savenko
first commit
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
<th colspan="2"><?php echo $formatter->asDecimal($sum, 2); ?></th>
</tr>
</tfoot>
</table>
</div>
<!-- /.table-responsive -->
<div class="box-footer">
<div class="pull-left">
<?php
echo Html::a(
Html::icon('chevron-left', [ 'prefix' => 'fa fa-' ]) . \Yii::t(
'app',
|
e226698d
mzavalniuk
translate shop pa...
|
145
|
' Подовжити покупки'
|
950817c6
Alex Savenko
first commit
|
146
147
148
149
150
151
152
153
154
155
156
157
158
|
),
[ 'site/index' ],
[
'class' => 'btn btn-default',
]
)
?>
</div>
<div class="pull-right">
<?php
echo Html::a(
\Yii::t(
'app',
|
e226698d
mzavalniuk
translate shop pa...
|
159
|
' Оформити замовлення '
|
950817c6
Alex Savenko
first commit
|
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
) . Html::icon('chevron-right', [ 'prefix' => 'fa fa-' ]),
[ 'checkout/info' ],
[
'class' => 'btn btn-success',
]
)
?>
</div>
</div>
</div>
<!-- /.box -->
</div>
<div class="col-md-3">
<div class="box" id="order-summary">
<div class="box-header">
|
d81ec2cf
mzavalniuk
translate shop pa...
|
179
|
<h3><?php echo Yii::t('app','Total count')?></h3>
|
950817c6
Alex Savenko
first commit
|
180
181
182
|
</div>
<p class="text-muted small"><?php echo \Yii::t(
'app',
|
d81ec2cf
mzavalniuk
translate shop pa...
|
183
|
'total_text'
|
950817c6
Alex Savenko
first commit
|
184
185
186
187
188
189
|
); ?></p>
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
|
e226698d
mzavalniuk
translate shop pa...
|
190
|
<td><?php echo \Yii::t('app', 'Всього за товари'); ?></td>
|
950817c6
Alex Savenko
first commit
|
191
192
193
|
<th><?php echo $formatter->asDecimal($sum, 2); ?></th>
</tr>
<tr>
|
e226698d
mzavalniuk
translate shop pa...
|
194
|
<td><?php echo \Yii::t('app', 'Сума знижки'); ?></td>
|
950817c6
Alex Savenko
first commit
|
195
196
197
|
<th><?php echo $formatter->asDecimal($sumDiscount, 2); ?></th>
</tr>
<tr class="total">
|
e226698d
mzavalniuk
translate shop pa...
|
198
|
<td><?php echo \Yii::t('app', 'Всього до сплати'); ?></td>
|
950817c6
Alex Savenko
first commit
|
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
<th><?php echo $formatter->asDecimal($sum, 2); ?></th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
} else { ?>
<!-- echo Html::tag('p', \Yii::t('app', 'Ваша корзина пуста!'));-->
<div class="empty_card">Ваша корзина пуста!</div>
<?php }
?>
</div>
<?php
if (!empty($topItems)) {
?>
<div class="col-xs-12 heading text-center" style="margin-top: 40px;">
|
e226698d
mzavalniuk
translate shop pa...
|
219
|
<h2><?php echo \Yii::t('app', 'Дивіться також'); ?></h2>
|
950817c6
Alex Savenko
first commit
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
</div>
<div class="col-xs-12 product-carousel">
<div class="homepage owl-carousel">
<?php
$newItemsArrays = array_chunk($topItems, 4);
foreach ($newItemsArrays as $newItemsArray) {
?>
<div class="products">
<?php
foreach ($newItemsArray as $product) {
echo $this->render(
'@frontend/views/site/_slider_product',
[
'product' => $product,
]
);
}
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
|