/** * Calculates the total quantity for this item. * * What this really means is that if this is a child item, it return the parent quantity times * the child quantity and return that as the child's quantity. * * @param QuoteDetailsItem $item * @return float */ protected function getTotalQuantity(QuoteDetailsItem $item) { if ($item->getParentCode()) { $parentQuantity = $this->keyedItems[$item->getParentCode()]->getQuantity(); return $parentQuantity * $item->getQuantity(); } return $item->getQuantity(); }
/** * Callback function that creates a tax details item from a quote details item for testing. * * @param QuoteDetailsItem $item * @return Data\TaxDetails\Item */ public function createTaxDetailsItem(QuoteDetailsItem $item) { $rowTotal = $item->getUnitPrice() * $item->getQuantity(); $rowTax = $rowTotal * self::TAX; return $this->taxDetailsItemBuilder->populateWithArray($item->__toArray())->setPrice($item->getUnitPrice())->setRowTotal($rowTotal)->setTaxPercent(self::TAX)->setRowTax($rowTax)->setRowTotalInclTax($rowTotal + $rowTax)->setPriceInclTax($item->getUnitPrice() + $item->getUnitPrice() * self::TAX)->create(); }