|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use yii\helpers\Html; |
|
4
|
|
|
use yii\helpers\Url; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* @var \hiqdev\yii2\cart\ShoppingCart $cart |
|
8
|
|
|
* @var \hiqdev\yii2\cart\widgets\CartTeaser $widget |
|
9
|
|
|
* @var \yii\web\View $this |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
$this->registerCss(<<<CSS |
|
13
|
|
|
.navbar-nav > .notifications-menu > .dropdown-menu > li .menu > li > a { |
|
14
|
|
|
border-bottom: none; |
|
15
|
|
|
} |
|
16
|
|
|
.cart-row { |
|
17
|
|
|
display: flex; |
|
18
|
|
|
flex-direction: row; |
|
19
|
|
|
justify-content: space-between; |
|
20
|
|
|
border-bottom: 1px solid #f4f4f4; |
|
21
|
|
|
} |
|
22
|
|
|
.cart-item { |
|
23
|
|
|
width: 245px; |
|
24
|
|
|
} |
|
25
|
|
|
.cart-remove > i { |
|
26
|
|
|
width: 12px !important; |
|
27
|
|
|
color: grey; |
|
28
|
|
|
} |
|
29
|
|
|
CSS |
|
30
|
|
|
); |
|
31
|
|
|
|
|
32
|
|
|
$widget->registerCartClearJs(); |
|
33
|
|
|
|
|
34
|
|
|
?> |
|
35
|
|
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#"> |
|
36
|
|
|
<i class="fa fa-shopping-cart fa-lg"></i> |
|
37
|
|
|
<span class="label label-<?= $cart->count ? 'warning' : 'default' ?>"><?= $cart->count ?></span> |
|
38
|
|
|
</a> |
|
39
|
|
|
<ul class="dropdown-menu"> |
|
40
|
|
|
<?php if ($cart->count) : ?> |
|
41
|
|
|
<li class="header"> |
|
42
|
|
|
<div class="row"> |
|
43
|
|
|
<div class="col-md-4"><?= Html::a(Yii::t('cart', 'Cart'), $widget->module->createUrl()) ?>:</div> |
|
|
|
|
|
|
44
|
|
|
<div class="col-md-8 text-bold text-right"> |
|
45
|
|
|
<?= Yii::t('cart', 'Total') ?> : <?= $cart->formatCurrency($cart->total) ?> |
|
|
|
|
|
|
46
|
|
|
</div> |
|
47
|
|
|
</div> |
|
48
|
|
|
</li> |
|
49
|
|
|
<li> |
|
50
|
|
|
<ul class="menu"> |
|
51
|
|
|
<?php foreach ($cart->getRootPositions() as $positionKey => $position) : ?> |
|
52
|
|
|
<?php /** @var \hiqdev\yii2\cart\CartPositionTrait $position */ ?> |
|
53
|
|
|
<li class="cart-row"> |
|
54
|
|
|
<?= Html::a($position->renderDescription(true), [$widget->module->createUrl(), 'id' => $positionKey], ['class' => 'cart-item']) ?> |
|
|
|
|
|
|
55
|
|
|
<?= Html::a('<i class="fa fa-times"></i>', '#', ['class' => 'cart-remove', 'data-action' => Url::to(['@cart/remove', 'id' => $positionKey])]) ?> |
|
56
|
|
|
</li> |
|
57
|
|
|
<?php endforeach ?> |
|
58
|
|
|
</ul> |
|
59
|
|
|
</li> |
|
60
|
|
|
<li class="footer"><?= Html::a(Yii::t('cart', 'Clear cart'), '#', ['class' => 'cart-clear', 'data-action' => Url::to('@cart/clear')]) ?></li> |
|
61
|
|
|
<li class="footer"><?= Html::a(Yii::t('cart', 'View cart'), $widget->module->createUrl()) ?></li> |
|
|
|
|
|
|
62
|
|
|
<?php else : ?> |
|
63
|
|
|
<li class="header"> |
|
64
|
|
|
<div class="row"> |
|
65
|
|
|
<div class="col-md-6"><?= Yii::t('cart', 'Your cart is empty') ?></div> |
|
66
|
|
|
</div> |
|
67
|
|
|
</li> |
|
68
|
|
|
<?php endif ?> |
|
69
|
|
|
</ul> |
|
70
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.