*/ class Mage_XmlConnect_Block_Cart_Paypal_Mep_Totals extends Mage_Checkout_Block_Cart_Totals { /** * Render cart totals xml * * @return string */ protected function _toHtml() { /** @var $paypalCart Mage_Paypal_Model_Cart */ $paypalCart = Mage::getModel('paypal/cart', array($this->getQuote())); /** @var $totalsXmlObj Mage_XmlConnect_Model_Simplexml_Element */ $totalsXmlObj = Mage::getModel('xmlconnect/simplexml_element', ''); foreach ($paypalCart->getTotals(true) as $code => $amount) { $currencyAmount = $this->helper('core')->currency($amount, false, false); $totalsXmlObj->addChild($code, sprintf('%01.2F', $currencyAmount)); } $paypalTotals = $totalsXmlObj->addChild('paypal_totals'); foreach ($this->getQuote()->getTotals() as $total) { $code = $total->getCode(); if ($code == 'giftcardaccount' || $code == 'giftwrapping') { continue; } $renderer = $this->_getTotalRenderer($code)->setTotal($total); switch ($code) { case 'subtotal': $subtotal = intval($total->getValueExclTax()) ? $total->getValueExclTax() : $total->getValue(); $paypalTotals->addAttribute( $code, Mage::helper('xmlconnect')->formatPriceForXml($subtotal) ); break; case 'tax': $paypalTotals->addAttribute( $code, Mage::helper('xmlconnect')->formatPriceForXml($total->getValue()) ); break; case 'shipping': $paypalTotals->addAttribute( $code, Mage::helper('xmlconnect')->formatPriceForXml($renderer->getShippingExcludeTax()) ); break; default: break; } } return $totalsXmlObj->asNiceXml(); } }