/** * Overwrite @method _addItemToQtyArray * * Adds stock item qty to $items (creates new entry or increments existing one) * $items is array with following structure: * array( * $productId => array( * 'qty' => $qty, * 'item' => $stockItems|null * ) * ) * * @param Mage_Sales_Model_Quote_Item $quoteItem * @param array &$items */ protected function _addItemToQtyArray($quoteItem, &$items) { $productId = $quoteItem->getProductId(); if (!$productId) { return; } if (isset($items[$productId])) { $items[$productId]['qty'] += $quoteItem->getTotalQty(); } else { $stockItem = null; if ($quoteItem->getProduct()) { $stockItem = $quoteItem->getProduct()->getStockItem(); } $items[$productId] = array('item' => $stockItem, 'qty' => $quoteItem->getTotalQty(), 'quote_item_id' => $quoteItem->getId(), 'creditmemo_item_id' => null); } }
/** * Adds stock item qty to $items (creates new entry or increments existing one) * $items is array with following structure: * array( * $productId => array( * 'qty' => $qty, * 'item' => $stockItems|null * ) * ) * * @param Mage_Sales_Model_Quote_Item $quoteItem * @param array &$items */ private function _addItemToQtyArray($quoteItem, &$items) { $productId = $quoteItem->getProductId(); if (!$productId) { return; } if (isset($items[$productId])) { $items[$productId]['qty'] += $quoteItem->getTotalQty(); } else { $stockItem = null; if ($quoteItem->getProduct()) { $stockItem = $quoteItem->getProduct()->getStockItem(); } $items[$productId] = array('item' => $stockItem, 'qty' => $quoteItem->getTotalQty()); } }
/** * Calculate item row total * * @param Mage_Sales_Model_Quote_Item $item * @return $this * @see Mage_Sales_Model_Quote_Item::calcRowTotal() */ protected function _calcItemRowTotal($item) { $qty = $item->getTotalQty(); $total = $this->_getDataHelper()->roundUp($item->getCalculationPriceOriginal(), 4) * $qty; $baseTotal = $this->_getDataHelper()->roundUp($item->getBaseCalculationPriceOriginal(), 4) * $qty; $item->setRowTotal($this->_getDataHelper()->roundUp($total, 4)); $item->setBaseRowTotal($this->_getDataHelper()->roundUp($baseTotal, 4)); return $this; }