public function Sum($field, $onproduct = false)
    {
        $total = 0;
        foreach ($this->getIterator() as $item) {
            $quantity = ($field === 'Quantity') ? 1 : $item->Quantity;
            if (!$onproduct) {
                $total += $item->$field * $quantity;
            } elseif ($item->hasMethod($field)) {
                $total += $item->$field() * $quantity;
            } elseif ($product = $item->Product()) {
                $total += $product->$field * $quantity;
            }
        }
        return $total;
    }