From 791b9ed5cb69d2306f31d1a50dac35684b1c3b71 Mon Sep 17 00:00:00 2001 From: stes Date: Tue, 12 Sep 2017 16:30:36 +0300 Subject: [PATCH] basket --- models/Basket.php | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) diff --git a/models/Basket.php b/models/Basket.php index 4f82e79..ca86649 100755 --- a/models/Basket.php +++ b/models/Basket.php @@ -8,6 +8,8 @@ use yii\web\Cookie; use yii\web\NotFoundHttpException; + + /** * Class Basket to work with basket */ @@ -19,6 +21,9 @@ * @var \yii\web\Session */ protected $session; + public $config = [ + 'count_all' => false, + ]; /** * Basket constructor. @@ -165,9 +170,17 @@ public function getCount(): int { $data = $this->getData(); + if ($this->config['count_all']){ + $all_data = 0; + foreach($data as $item){ + $all_data +=$item['count']; + } + return $all_data; + } return count($data); } + /** * Get sum of variants in basket * -- libgit2 0.21.4