These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use hiqdev\yii2\cart\widgets\QuantityCell; |
||
4 | use yii\grid\ActionColumn; |
||
5 | use yii\grid\GridView; |
||
6 | use yii\helpers\Html; |
||
7 | |||
8 | $this->title = Yii::t('cart', 'Cart'); |
||
9 | $this->params['breadcrumbs'][] = $this->title; |
||
10 | |||
11 | /** @var \yii\web\View $this */ |
||
12 | /** @var \yii\data\ActiveDataProvider $dataProvider */ |
||
13 | /** @var \hiqdev\yii2\cart\ShoppingCart $cart */ |
||
14 | /** @var \hiqdev\yii2\cart\Module $module */ |
||
15 | ?> |
||
16 | |||
17 | <section class="invoice"> |
||
18 | <!-- title row --> |
||
19 | <div class="row"> |
||
20 | <div class="col-md-12"> |
||
21 | <h2 class="page-header"> |
||
22 | <i class="fa fa-shopping-cart"></i> |
||
23 | <?= Yii::t('cart', 'Your order') ?>: |
||
24 | <?= Yii::t('cart', '{0, plural, one{# position} other{# positions}}', $cart->count) ?> |
||
25 | <small class="pull-right"><?= Yii::t('cart', 'Date') ?> |
||
26 | : <?= Yii::$app->formatter->asDate(new DateTime()) ?></small> |
||
27 | </h2> |
||
28 | </div> |
||
29 | </div> |
||
30 | |||
31 | <!-- Table row --> |
||
32 | <div class="row"> |
||
33 | <div class="col-md-12"> |
||
34 | <?php |
||
35 | echo GridView::widget([ |
||
36 | 'dataProvider' => $dataProvider, |
||
37 | 'layout' => '{items}', |
||
38 | 'options' => ['class' => 'grid-view table-responsive'], |
||
39 | 'rowOptions' => function ($model, $key, $index, $grid) { |
||
40 | return $model->getRowOptions($key, $index, $grid); |
||
41 | }, |
||
42 | 'columns' => [ |
||
43 | [ |
||
44 | 'attribute' => 'no', |
||
45 | 'label' => '#', |
||
46 | 'value' => function ($model) { |
||
47 | static $no; |
||
48 | |||
49 | return ++$no; |
||
50 | }, |
||
51 | 'headerOptions' => ['width' => '4%', 'style' => 'text-align: center'], |
||
52 | 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle;'], |
||
53 | ], |
||
54 | [ |
||
55 | 'attribute' => 'name', |
||
56 | 'format' => 'raw', |
||
57 | 'label' => Yii::t('cart', 'Description'), |
||
58 | 'contentOptions' => ['style' => 'vertical-align: middle;', 'width' => '60%'], |
||
59 | 'value' => function ($model) { |
||
60 | /** @var \hiqdev\yii2\cart\CartPositionTrait $model */ |
||
61 | return $model->renderDescription(); |
||
62 | }, |
||
63 | ], |
||
64 | [ |
||
65 | 'attribute' => 'quantity', |
||
66 | 'label' => Yii::t('cart', 'Quantity'), |
||
67 | 'contentOptions' => ['style' => 'vertical-align: middle'], |
||
68 | 'value' => function ($model, $key, $index, $column) { |
||
69 | return QuantityCell::widget(['model' => $model]); //, 'type' => 'number' |
||
70 | }, |
||
71 | 'format' => 'raw', |
||
72 | ], |
||
73 | [ |
||
74 | 'attribute' => 'price', |
||
75 | 'label' => Yii::t('cart', 'Price'), |
||
76 | 'contentOptions' => ['style' => 'vertical-align: middle;white-space: nowrap;'], |
||
77 | 'value' => function ($model) use ($cart) { |
||
78 | return $cart->formatCurrency($model->cost, $model->currency); |
||
79 | }, |
||
80 | ], |
||
81 | 'actions' => [ |
||
82 | 'class' => ActionColumn::class, |
||
83 | 'template' => '{remove}', |
||
84 | 'headerOptions' => ['width' => '4%'], |
||
85 | 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle;'], |
||
86 | 'buttons' => [ |
||
87 | 'remove' => function ($url, $model, $key) { |
||
0 ignored issues
–
show
|
|||
88 | return Html::a('<i class="fa fa-times text-danger"></i>', ['remove', 'id' => $model->id]); |
||
89 | }, |
||
90 | ], |
||
91 | ], |
||
92 | ], |
||
93 | ]); ?> |
||
94 | </div> |
||
95 | </div> |
||
96 | |||
97 | <div class="row"> |
||
98 | <?php if (!empty($module->cart->additionalLinks)) : ?> |
||
99 | <div class="col-md-12" style="margin-bottom: 1em;"> |
||
100 | <?= Html::tag('p', Yii::t('cart', 'Additional Links'), ['class' => 'lead']) ?> |
||
101 | <?php foreach ($module->cart->additionalLinks as $url => $label) : ?> |
||
102 | <?= Html::a($label, $url, ['class' => 'btn bg-olive btn-flat']) ?> |
||
103 | <?php endforeach ?> |
||
104 | </div> |
||
105 | <?php endif ?> |
||
106 | <!-- accepted payments column --> |
||
107 | <div class="col-md-8"> |
||
108 | <?= $module->paymentMethods ?> |
||
109 | </div> |
||
110 | <!-- /.col --> |
||
111 | <div class="col-md-4"> |
||
112 | <p class="lead"><?= Yii::t('cart', 'Amount due') ?>:</p> |
||
113 | <div class="table-responsive"> |
||
114 | <table class="table"> |
||
115 | <tbody> |
||
116 | <tr> |
||
117 | <th style="width:30%"><?= Yii::t('cart', 'Subtotal') ?>:</th> |
||
118 | <td style="width:30%" align="right"><?= $cart->formatCurrency($cart->subtotal) ?></td> |
||
119 | <td></td> |
||
120 | </tr> |
||
121 | <tr> |
||
122 | <th><?= Yii::t('cart', 'Discount') ?>:</th> |
||
123 | <td align="right"><?= $cart->formatCurrency($cart->discount) ?></td> |
||
124 | <td></td> |
||
125 | </tr> |
||
126 | <tr style="font-size:130%;font-weight:bold"> |
||
127 | <th><?= Yii::t('cart', 'Total') ?>:</th> |
||
128 | <td align="right"><?= $cart->formatCurrency($cart->total) ?></td> |
||
129 | <td></td> |
||
130 | </tr> |
||
131 | </tbody> |
||
132 | </table> |
||
133 | </div> |
||
134 | </div> |
||
135 | <!-- /.col --> |
||
136 | </div> |
||
137 | <!-- /.row --> |
||
138 | |||
139 | <!-- this row will not appear when printing --> |
||
140 | <div class="row no-print"> |
||
141 | <div class="col-md-4 col-xs-12"> |
||
142 | <?= Html::a('<i class="fa fa-trash"></i> ' . Yii::t('cart', 'Clear cart'), ['clear'], [ |
||
143 | 'class' => 'btn btn-default', |
||
144 | 'data-ga-clear' => true, |
||
145 | ]); ?> |
||
146 | </div> |
||
147 | <?php if (!empty($cart->positions)) : ?> |
||
148 | <div class="col-md-8 col-xs-12"> |
||
149 | <span class="pull-right"> |
||
150 | <?php if ($module->orderButton) : ?> |
||
151 | <?= $module->orderButton ?> |
||
152 | <?php else : ?> |
||
153 | <?= Html::a('<i class="fa fa-credit-card"></i> ' . Yii::t('cart', 'Make order'), $module->orderPage, [ |
||
154 | 'id' => 'make-order-button', |
||
155 | 'class' => 'btn btn-success', |
||
156 | 'data-ga-confirm' => true, |
||
157 | ]); ?> |
||
158 | <?php endif ?> |
||
159 | </span> |
||
160 | </div> |
||
161 | <?php endif; ?> |
||
162 | </div> |
||
163 | </section> |
||
164 | |||
165 | <?php |
||
166 | $this->registerJS(<<<JS |
||
167 | hipanel.googleAnalytics($('[data-ga-confirm]'), { |
||
168 | 'category': 'cart', |
||
169 | 'action': 'confirm' |
||
170 | }); |
||
171 | hipanel.googleAnalytics($('[data-ga-clear]'), { |
||
172 | 'category': 'cart', |
||
173 | 'action': 'clear' |
||
174 | }); |
||
175 | JS |
||
176 | ); |
||
177 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.