00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Sales_Block_Order_Info extends Mage_Core_Block_Template
00036 {
00037 protected $_links = array();
00038
00039 protected function _construct()
00040 {
00041 parent::_construct();
00042 $this->setTemplate('sales/order/info.phtml');
00043 }
00044
00045 protected function _prepareLayout()
00046 {
00047 if ($headBlock = $this->getLayout()->getBlock('head')) {
00048 $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
00049 }
00050 $this->setChild(
00051 'payment_info',
00052 $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
00053 );
00054 }
00055
00056 public function getPaymentInfoHtml()
00057 {
00058 return $this->getChildHtml('payment_info');
00059 }
00060
00061
00062
00063
00064
00065
00066 public function getOrder()
00067 {
00068 return Mage::registry('current_order');
00069 }
00070
00071 public function addLink($name, $path, $label)
00072 {
00073 $this->_links[$name] = new Varien_Object(array(
00074 'name' => $name,
00075 'label' => $label,
00076 'url' => empty($path) ? '' : Mage::getUrl($path, array('order_id' => $this->getOrder()->getId()))
00077 ));
00078 return $this;
00079 }
00080
00081 public function getLinks()
00082 {
00083 $this->checkLinks();
00084 return $this->_links;
00085 }
00086
00087 private function checkLinks()
00088 {
00089 $order = $this->getOrder();
00090 if (!$order->hasInvoices()) {
00091 unset($this->_links['invoice']);
00092 }
00093 if (!$order->hasShipments()) {
00094 unset($this->_links['shipment']);
00095 }
00096 if (!$order->hasCreditmemos()) {
00097 unset($this->_links['creditmemo']);
00098 }
00099 }
00100
00101 public function getReorderUrl($order)
00102 {
00103 return $this->getUrl('sales/order/reorder', array('order_id' => $order->getId()));
00104 }
00105
00106 public function getPrintUrl($order)
00107 {
00108 return $this->getUrl('sales/order/print', array('order_id' => $order->getId()));
00109 }
00110
00111 }