1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Checkout
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Multishipping billing information
29: *
30: * @category Mage
31: * @package Mage_Checkout
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Checkout_Block_Multishipping_Billing extends Mage_Payment_Block_Form_Container
35: {
36: /**
37: * Prepare children blocks
38: */
39: protected function _prepareLayout()
40: {
41: if ($headBlock = $this->getLayout()->getBlock('head')) {
42: $headBlock->setTitle(
43: Mage::helper('checkout')->__('Billing Information - %s', $headBlock->getDefaultTitle())
44: );
45: }
46:
47: return parent::_prepareLayout();
48: }
49:
50: /**
51: * Check and prepare payment method model
52: *
53: * @return bool
54: */
55: protected function _canUseMethod($method)
56: {
57: if (!$method->canUseForMultishipping()) {
58: return false;
59: }
60: return parent::_canUseMethod($method);
61: }
62:
63: /**
64: * Retrieve code of current payment method
65: *
66: * @return mixed
67: */
68: public function getSelectedMethodCode()
69: {
70: if ($method = $this->getQuote()->getPayment()->getMethod()) {
71: return $method;
72: }
73: return false;
74: }
75:
76: /**
77: * Retrieve billing address
78: *
79: * @return Mage_Sales_Model_Quote_Address
80: */
81: public function getAddress()
82: {
83: $address = $this->getData('address');
84: if (is_null($address)) {
85: $address = Mage::getSingleton('checkout/type_multishipping')->getQuote()->getBillingAddress();
86: $this->setData('address', $address);
87: }
88: return $address;
89: }
90:
91: /**
92: * Retrieve quote model object
93: *
94: * @return Mage_Sales_Model_Quote
95: */
96: public function getQuote()
97: {
98: return Mage::getSingleton('checkout/session')->getQuote();
99: }
100:
101: /**
102: * Getter
103: *
104: * @return float
105: */
106: public function getQuoteBaseGrandTotal()
107: {
108: return (float)$this->getQuote()->getBaseGrandTotal();
109: }
110:
111: /**
112: * Retrieve url for select billing address
113: *
114: * @return string
115: */
116: public function getSelectAddressUrl()
117: {
118: return $this->getUrl('*/multishipping_address/selectBilling');
119: }
120:
121: /**
122: * Retrieve data post destination url
123: *
124: * @return string
125: */
126: public function getPostActionUrl()
127: {
128: //return $this->getUrl('*/*/billingPost');
129: return $this->getUrl('*/*/overview');
130: }
131:
132: /**
133: * Retrieve back url
134: *
135: * @return string
136: */
137: public function getBackUrl()
138: {
139: return $this->getUrl('*/*/backtoshipping');
140: }
141: }
142: