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
|
<?php
/**
* @var \yii\web\View $this
* @var \artbox\order\models\Basket $basket
* @var \frontend\models\Order $model
*/
use artbox\core\helpers\ImageHelper;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Html;
$formatter = \Yii::$app->formatter;
$basket = \Yii::$app->get('basket');
$sum = 0;
$sumDiscount = 0;
$variants = $basket->findModels(array_keys($basket->getData()));
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 class="col-md-9 clearfix" id="checkout">
<div class="box">
<?php
$form = ActiveForm::begin();
?>
<ul class="nav nav-pills nav-justified">
<?php
echo Html::tag(
'li',
Html::a(
Html::icon(
'map-marker',
[
'prefix' => 'fa fa-',
]
|
d81ec2cf
mzavalniuk
translate shop pa...
|
46
|
) . Html::tag('br') . \Yii::t('app', 'Адреса'),
|
950817c6
Alex Savenko
first commit
|
47
48
49
50
51
52
53
54
55
56
57
|
[ 'checkout/info' ]
)
);
echo Html::tag(
'li',
Html::a(
Html::icon(
'truck',
[
'prefix' => 'fa fa-',
]
|
d81ec2cf
mzavalniuk
translate shop pa...
|
58
|
) . Html::tag('br') . \Yii::t('app', 'Спосіб доставки'),
|
950817c6
Alex Savenko
first commit
|
59
60
61
62
63
64
65
66
67
68
69
|
[ 'checkout/delivery' ]
)
);
echo Html::tag(
'li',
Html::a(
Html::icon(
'money',
[
'prefix' => 'fa fa-',
]
|
d81ec2cf
mzavalniuk
translate shop pa...
|
70
|
) . Html::tag('br') . \Yii::t('app', 'Спосіб оплати'),
|
950817c6
Alex Savenko
first commit
|
71
72
73
74
75
76
77
78
79
80
81
82
83
|
[
'checkout/payment',
]
)
);
echo Html::tag(
'li',
Html::a(
Html::icon(
'eye',
[
'prefix' => 'fa fa-',
]
|
d81ec2cf
mzavalniuk
translate shop pa...
|
84
|
) . Html::tag('br') . \Yii::t('app', 'Перегляд замовлення'),
|
950817c6
Alex Savenko
first commit
|
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
'#'
),
[
'class' => 'active',
]
);
?>
</ul>
<div class="content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th colspan="2"><?php echo \Yii::t('app', 'Product'); ?></th>
<th><?php echo \Yii::t('app', 'Quantity'); ?></th>
<th><?php echo \Yii::t('app', 'Unit price'); ?></th>
<th><?php echo \Yii::t('app', 'Discount'); ?></th>
<th><?php echo \Yii::t('app', 'Total'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($variants as $variant) {
?>
<tr>
<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
if (!empty($item = $basket->getItem($variant->id))) {
echo $item[ 'count' ];
}
?></td>
<td><?php echo ( $variant->price ? : 0 ) . ' грн.'; ?></td>
<td><?php echo ( ( $variant->price_old - $variant->price ) ? : 0 ) . ' грн.'; ?></td>
<td><?php echo $variant->price * $item[ 'count' ] . ' грн.'; ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th colspan="5"><?php echo \Yii::t('app', 'Total'); ?></th>
<th><?php echo $sum; ?> грн.</th>
</tr>
</tfoot>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.content -->
<div class="box-footer">
<div class="pull-left">
<?php
echo Html::a(
Html::icon(
'chevron-left',
[
'prefix' => 'fa fa-',
]
) . \Yii::t('app', 'Back to payment method'),
[
'checkout/payment',
],
[
'class' => 'btn btn-default',
]
)
?>
</div>
<div class="pull-right">
<?php
echo Html::submitButton(
|
d81ec2cf
mzavalniuk
translate shop pa...
|
190
|
\Yii::t('app', 'Оформити замовлення'),
|
950817c6
Alex Savenko
first commit
|
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
[
'class' => 'btn btn-success',
]
);
?>
</div>
</div>
<?php
$form::end();
?>
</div>
<!-- /.box -->
</div>
<!-- /.col-md-9 -->
<div class="col-md-3">
<div class="box" id="order-summary">
<div class="box-header">
|
d81ec2cf
mzavalniuk
translate shop pa...
|
211
|
<h3><?php echo \Yii::t('app', 'Total count'); ?></h3>
|
950817c6
Alex Savenko
first commit
|
212
213
214
|
</div>
<p class="text-muted small"><?php echo \Yii::t(
'app',
|
d81ec2cf
mzavalniuk
translate shop pa...
|
215
|
'total_text'
|
950817c6
Alex Savenko
first commit
|
216
217
218
219
220
221
|
); ?></p>
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
|
d81ec2cf
mzavalniuk
translate shop pa...
|
222
|
<td><?php echo \Yii::t('app', 'Всього за товари'); ?></td>
|
950817c6
Alex Savenko
first commit
|
223
224
225
|
<th><?php echo $sum; ?> грн.</th>
</tr>
<tr>
|
d81ec2cf
mzavalniuk
translate shop pa...
|
226
|
<td><?php echo \Yii::t('app', 'Сума знижки'); ?></td>
|
950817c6
Alex Savenko
first commit
|
227
228
229
230
231
232
233
|
<th><?php echo $sumDiscount; ?> грн.</th>
</tr>
<tr>
<td><?php echo \Yii::t('app', 'Стоимость доставки'); ?></td>
<th><?php echo $model->delivery->value; ?> грн.</th>
</tr>
<tr class="total">
|
d81ec2cf
mzavalniuk
translate shop pa...
|
234
|
<td><?php echo \Yii::t('app', 'Всього до сплати'); ?></td>
|
950817c6
Alex Savenko
first commit
|
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
<th><?php echo $sum + $model->delivery->value; ?> грн.</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.col-md-3 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
|