$address->getQuote()->getStore()) ); // invoke nominal totals foreach ($collector->getCollectors() as $model) { $model->collect($address); } // aggregate collected amounts into one to have sort of grand total per item foreach ($address->getAllNominalItems() as $item) { $rowTotal = 0; $baseRowTotal = 0; $totalDetails = array(); foreach ($collector->getCollectors() as $model) { $itemRowTotal = $model->getItemRowTotal($item); if ($model->getIsItemRowTotalCompoundable($item)) { $rowTotal += $itemRowTotal; $baseRowTotal += $model->getItemBaseRowTotal($item); $isCompounded = true; } else { $isCompounded = false; } if ((float)$itemRowTotal > 0 && $label = $model->getLabel()) { $totalDetails[] = new Varien_Object(array( 'label' => $label, 'amount' => $itemRowTotal, 'is_compounded' => $isCompounded, )); } } $item->setNominalRowTotal($rowTotal); $item->setBaseNominalRowTotal($baseRowTotal); $item->setNominalTotalDetails($totalDetails); } return $this; } /** * Fetch collected nominal items * * @param Mage_Sales_Model_Quote_Address $address * @return Mage_Sales_Model_Quote_Address_Total_Nominal */ public function fetch(Mage_Sales_Model_Quote_Address $address) { $items = $address->getAllNominalItems(); if ($items) { $address->addTotal(array( 'code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Nominal Items'), 'items' => $items, 'area' => 'footer', )); } return $this; } }