Skip to content

Commit fe25643

Browse files
author
igor-chepurnoi
committed
update README
1 parent 07fe076 commit fe25643

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ return [
3434
//....
3535
'components' => [
3636
'cart' => [
37-
'class' => 'yii2mod\cart\Cart'
37+
'class' => 'yii2mod\cart\Cart',
38+
// you can change default storage class as following:
39+
'storageClass' => [
40+
'class' => 'yii2mod\cart\storage\DatabaseStorage',
41+
// you can also override some properties
42+
'deleteIfEmpty' => true
43+
]
3844
],
3945
]
4046
];
@@ -85,8 +91,21 @@ $totalVat = $cart->getAttributeTotal('vat');
8591
// clear the cart
8692
$cart->clear();
8793

88-
// render the contents of the cart with default parameters
89-
echo \yii2mod\cart\widgets\CartGrid::widget();
94+
```
95+
96+
#### View Cart Items
97+
98+
You can use the `CartGrid` widget for generate table with cart items as following:
99+
```php
100+
<?php echo \yii2mod\cart\widgets\CartGrid::widget([
101+
// Some widget property maybe need to change.
102+
'cartColumns' => [
103+
'id',
104+
'label',
105+
'price'
106+
]
107+
]); ?>
108+
90109
```
91110

92111
#### Items in the cart

0 commit comments

Comments
 (0)