/** * 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 QuoteDetailsItemInterface $item * @return float */ protected function getTotalQuantity(QuoteDetailsItemInterface $item) { if ($item->getParentCode()) { $parentQuantity = $this->keyedItems[$item->getParentCode()]->getQuantity(); return $parentQuantity * $item->getQuantity(); } return $item->getQuantity(); }
/** * 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. This code is a duplicate of the * @see \Magento\Tax\Model\TaxCalculation::getTotalQuantity() * method, but is refactored to accept the $keyedItems array. * * @param QuoteDetailsItemInterface $item * @param array $keyedItems * @return float */ public function calculateTotalQuantity(QuoteDetailsItemInterface $item, array $keyedItems) { if ($item->getParentCode()) { $parentQuantity = $keyedItems[$item->getParentCode()]->getQuantity(); return $parentQuantity * $item->getQuantity(); } return $item->getQuantity(); }