/** * Generate and add the CoD totals to the parent block. * * @return Balticode_CashOnDelivery_Block_Totals_Abstract */ public function initTotals() { $this->_prepareTotals(); if (Mage::helper('Balticode_Cashondelivery/data')->isMe($this->_parentBlock->getOrder())) { if ($this->_totalObject->getCodFee()) { $label = $this->__('Cash on Delivery fee'); $value = $this->_totalObject->getCodFee(); $baseValue = $this->_totalObject->getBaseCodFee(); $code = 'balticode_cashondelivery_fee'; if (Mage::helper('Balticode_Cashondelivery/data')->displayCodBothPrices()) { $label = $this->__('Cash on Delivery fee (Excl.Tax)'); $totalInclLabel = $this->__('Cash on Delivery fee (Incl.Tax)'); $totalInclValue = $this->_totalObject->getCodFee() + $this->_totalObject->getCodTaxAmount(); $totalInclBaseValue = $this->_totalObject->getBaseCodFee() + $this->_totalObject->getBaseCodTaxAmount(); $totalInclCode = 'Balticode_cashondelivery_fee_incl'; } elseif (Mage::helper('Balticode_Cashondelivery/data')->displayCodFeeIncludingTax()) { $value = $this->_totalObject->getCodFee() + $this->_totalObject->getCodTaxAmount(); $baseValue = $this->_totalObject->getBaseCodFee() + $this->_totalObject->getBaseCodTaxAmount(); } $totalObject = $this->_getTotalObject($label, $value, $baseValue, $code); $this->_addTotalToParent($totalObject); if (isset($totalInclLabel)) { $totalInclObject = $this->_getTotalObject($totalInclLabel, $totalInclValue, $totalInclBaseValue, $totalInclCode); $this->_addTotalToParent($totalInclObject, 'balticode_cashondelivery_fee'); } } } return $this; }
/** * Returns true if edit link should be added to given block * * @param Mage_Core_Block_Abstract $block * @return boolean */ protected function _shouldAddPopup(Mage_Core_Block_Abstract $block) { return $block instanceof Mage_Sales_Block_Order_Item_Renderer_Default && Mage::helper('editcustomoptions/data')->isOrderEditable($block->getOrder()) && $block->getItem()->getProduct()->getHasOptions(); }