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_Sales
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: * Sales order view block
29: *
30: * @category Mage
31: * @package Mage_Sales
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Sales_Block_Order_View extends Mage_Core_Block_Template
35: {
36: protected function _construct()
37: {
38: parent::_construct();
39: $this->setTemplate('sales/order/view.phtml');
40: }
41:
42: protected function _prepareLayout()
43: {
44: if ($headBlock = $this->getLayout()->getBlock('head')) {
45: $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
46: }
47: $this->setChild(
48: 'payment_info',
49: $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
50: );
51: }
52:
53: public function getPaymentInfoHtml()
54: {
55: return $this->getChildHtml('payment_info');
56: }
57:
58: /**
59: * Retrieve current order model instance
60: *
61: * @return Mage_Sales_Model_Order
62: */
63: public function getOrder()
64: {
65: return Mage::registry('current_order');
66: }
67:
68: /**
69: * Return back url for logged in and guest users
70: *
71: * @return string
72: */
73: public function getBackUrl()
74: {
75: if (Mage::getSingleton('customer/session')->isLoggedIn()) {
76: return Mage::getUrl('*/*/history');
77: }
78: return Mage::getUrl('*/*/form');
79: }
80:
81: /**
82: * Return back title for logged in and guest users
83: *
84: * @return string
85: */
86: public function getBackTitle()
87: {
88: if (Mage::getSingleton('customer/session')->isLoggedIn()) {
89: return Mage::helper('sales')->__('Back to My Orders');
90: }
91: return Mage::helper('sales')->__('View Another Order');
92: }
93:
94: public function getInvoiceUrl($order)
95: {
96: return Mage::getUrl('*/*/invoice', array('order_id' => $order->getId()));
97: }
98:
99: public function getShipmentUrl($order)
100: {
101: return Mage::getUrl('*/*/shipment', array('order_id' => $order->getId()));
102: }
103:
104: public function getCreditmemoUrl($order)
105: {
106: return Mage::getUrl('*/*/creditmemo', array('order_id' => $order->getId()));
107: }
108:
109: }
110: