hiqdev /
yii2-cart
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
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\grid\PriceColumn; |
||
| 4 | use hiqdev\yii2\cart\widgets\QuantityCell; |
||
| 5 | use hiqdev\yii2\cart\CartPositionInterface; |
||
| 6 | use yii\grid\ActionColumn; |
||
| 7 | use yii\grid\GridView; |
||
| 8 | use yii\helpers\Html; |
||
| 9 | |||
| 10 | $this->title = Yii::t('cart', 'Cart'); |
||
| 11 | $this->params['breadcrumbs'][] = $this->title; |
||
| 12 | |||
| 13 | /** @var \yii\web\View $this */ |
||
| 14 | /** @var \yii\data\ActiveDataProvider $dataProvider */ |
||
| 15 | /** @var \hiqdev\yii2\cart\ShoppingCart $cart */ |
||
| 16 | /** @var \hiqdev\yii2\cart\Module $module */ |
||
| 17 | ?> |
||
| 18 | |||
| 19 | <section class="box box-widget"> |
||
| 20 | |||
| 21 | <div class="invoice-overlay overlay" style="display: none"> |
||
| 22 | <i class="fa fa-refresh fa-spin"></i> |
||
| 23 | </div> |
||
| 24 | |||
| 25 | <div class="box-header"> |
||
| 26 | <h3 class="box-title"> |
||
| 27 | <i class="fa fa-shopping-cart"></i> |
||
| 28 | <?= Yii::t('cart', 'Your order') ?>: |
||
| 29 | <?= Yii::t('cart', '{0, plural, one{# position} other{# positions}}', $cart->count) ?> |
||
| 30 | </h3> |
||
| 31 | <div class="box-tools pull-right"> |
||
| 32 | <small><?= Yii::t('cart', 'Date') ?> : <?= Yii::$app->formatter->asDate(new DateTime()) ?></small> |
||
| 33 | </div> |
||
| 34 | </div> |
||
| 35 | |||
| 36 | <div class="box-body"> |
||
| 37 | <div class="row"> |
||
| 38 | <div class="col-md-12"> |
||
| 39 | <?php |
||
| 40 | echo GridView::widget([ |
||
| 41 | 'dataProvider' => $dataProvider, |
||
| 42 | 'layout' => '{items}', |
||
| 43 | 'options' => ['class' => 'grid-view table-responsive'], |
||
| 44 | 'rowOptions' => function (CartPositionInterface $position, $key, $index, $grid) { |
||
| 45 | return $position->getRowOptions($key, $index, $grid); |
||
| 46 | }, |
||
| 47 | 'columns' => [ |
||
| 48 | [ |
||
| 49 | 'attribute' => 'no', |
||
| 50 | 'label' => '#', |
||
| 51 | 'value' => static function () { |
||
| 52 | static $no; |
||
| 53 | |||
| 54 | return ++$no; |
||
| 55 | }, |
||
| 56 | 'headerOptions' => ['width' => '4%', 'style' => 'text-align: center'], |
||
| 57 | 'contentOptions' => ['style' => 'text-align: center; vertical-align: middle;'], |
||
| 58 | ], |
||
| 59 | [ |
||
| 60 | 'attribute' => 'name', |
||
| 61 | 'format' => 'raw', |
||
| 62 | 'label' => Yii::t('cart', 'Description'), |
||
| 63 | 'contentOptions' => ['style' => 'vertical-align: middle;', 'width' => '60%'], |
||
| 64 | 'value' => static function (CartPositionInterface $cartPosition): string { |
||
| 65 | return $cartPosition->renderDescription(); |
||
| 66 | }, |
||
| 67 | ], |
||
| 68 | [ |
||
| 69 | 'attribute' => 'quantity', |
||
| 70 | 'label' => Yii::t('cart', 'Quantity'), |
||
| 71 | 'contentOptions' => ['style' => 'vertical-align: middle'], |
||
| 72 | 'value' => static function ($model) { |
||
| 73 | return QuantityCell::widget(['model' => $model]); |
||
| 74 | }, |
||
| 75 | 'format' => 'raw', |
||
| 76 | ], |
||
| 77 | [ |
||
| 78 | 'class' => PriceColumn::class, |
||
| 79 | 'cart' => $cart, |
||
| 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 | </div> |
||
| 164 | </section> |
||
| 165 | |||
| 166 | <?php |
||
| 167 | $this->registerJS(<<<JS |
||
| 168 | hipanel.googleAnalytics($('[data-ga-confirm]'), { |
||
| 169 | 'category': 'cart', |
||
| 170 | 'action': 'confirm' |
||
| 171 | }); |
||
| 172 | hipanel.googleAnalytics($('[data-ga-clear]'), { |
||
| 173 | 'category': 'cart', |
||
| 174 | 'action': 'clear' |
||
| 175 | }); |
||
| 176 | JS |
||
| 177 | ); |
||
| 178 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.