function getTotal() { $total = 0; $items = parent::toArray(); foreach ($items as $id => $quantity) { $total += $this->product[$id]['price'] * $quantity; } return $total; }