1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_XmlConnect_Block_Cart_Paypal_Mecl_Review extends Mage_Paypal_Block_Express_Review
35: {
36: 37: 38: 39: 40:
41: protected function _toHtml()
42: {
43:
44: $reviewXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<mecl_cart_details></mecl_cart_details>');
45:
46: if ($this->getPaypalMessages()) {
47: $reviewXmlObj->addChild('paypal_message', implode(PHP_EOL, $this->getPaypalMessages()));
48: }
49:
50: if ($this->getShippingAddress()) {
51: $reviewXmlObj->addCustomChild(
52: 'shipping_address',
53: Mage::helper('xmlconnect')->trimLineBreaks($this->getShippingAddress()->format('text')),
54: array('label' => $this->__('Shipping Address'))
55: );
56: }
57:
58: if ($this->_quote->isVirtual()) {
59: $reviewXmlObj->addCustomChild('shipping_method', null, array(
60: 'label' => $this->__('No shipping method required.')
61: ));
62: } elseif ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()) {
63: if ($groups = $this->getShippingRateGroups()) {
64: $currentRate = $this->getCurrentShippingRate();
65: foreach ($groups as $code => $rates) {
66: foreach ($rates as $rate) {
67: if ($currentRate === $rate) {
68: $reviewXmlObj->addCustomChild('shipping_method', null, array(
69: 'rate' => strip_tags($this->renderShippingRateOption($rate)),
70: 'label' => $this->getCarrierName($code)
71: ));
72: break(2);
73: }
74: }
75: }
76: }
77: }
78: $reviewXmlObj->addCustomChild('payment_method', $this->escapeHtml($this->getPaymentMethodTitle()), array(
79: 'label' => $this->__('Payment Method')
80: ));
81:
82: $reviewXmlObj->addCustomChild(
83: 'billing_address',
84: Mage::helper('xmlconnect')->trimLineBreaks($this->getBillingAddress()->format('text')),
85: array(
86: 'label' => $this->__('Billing Address'),
87: 'payer_email' => $this->__('Payer Email: %s', $this->getBillingAddress()->getEmail())
88: ));
89:
90: $this->getChild('details')->addDetailsToXmlObj($reviewXmlObj);
91:
92: return $reviewXmlObj->asNiceXml();
93: }
94: }
95: