1 | <?php |
||
22 | class ShoppingCart extends \yz\shoppingcart\ShoppingCart |
||
23 | { |
||
24 | /** |
||
25 | * @var AbstractCartPosition[] |
||
26 | * TODO make local AbstractCartPosition |
||
27 | */ |
||
28 | protected $_positions = []; |
||
29 | |||
30 | /** |
||
31 | * The cart module. |
||
32 | */ |
||
33 | public $module; |
||
34 | |||
35 | /** |
||
36 | * @return integer |
||
37 | */ |
||
38 | public function getCount() |
||
42 | |||
43 | public function getQuantity() |
||
52 | |||
53 | public function getSubtotal() |
||
57 | |||
58 | public function getTotal() |
||
62 | |||
63 | public function getDiscount() |
||
67 | |||
68 | public function formatCurrency($sum, $currency = null) |
||
69 | 1 | { |
|
70 | return $sum !== null ? Yii::$app->formatter->format($sum, ['currency', $currency ?? $this->getCurrency()]) : '--'; |
||
71 | 1 | } |
|
72 | |||
73 | /** |
||
74 | * Sets cart from serialized string |
||
75 | * @param string $serialized |
||
76 | */ |
||
77 | public function setSerialized($serialized) |
||
87 | |||
88 | /** |
||
89 | * Checks whether any of cart positions has error in `id` attribute. |
||
90 | * @return boolean |
||
91 | */ |
||
92 | public function hasErrors() |
||
102 | |||
103 | /** |
||
104 | * @param CartPositionInterface[] $positions |
||
105 | */ |
||
106 | public function putPositions($positions) |
||
129 | |||
130 | public function getCurrency(): ?string |
||
138 | |||
139 | /** |
||
140 | * @return array |
||
141 | */ |
||
142 | public function getAdditionalLinks(): array |
||
163 | } |
||
164 |