public function count($totalItems = true) { $items = $this->getCart(); if (!$totalItems) { return $items->count(); } $count = 0; foreach ($items as $row) { $count += $row->qty; } return $count; }