public function totalPrice() { $total = 0; $cart = $this->getCart(); if ($cart->isEmpty()) { return $total; } foreach ($cart as $row) { $total += $row->qty * $row->price; } return $total; }