Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
View.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
21  protected $_template = 'Magento_Sales::order/view.phtml';
22 
28  protected $_coreRegistry = null;
29 
34  protected $httpContext;
35 
39  protected $_paymentHelper;
40 
48  public function __construct(
49  \Magento\Framework\View\Element\Template\Context $context,
50  \Magento\Framework\Registry $registry,
51  \Magento\Framework\App\Http\Context $httpContext,
52  \Magento\Payment\Helper\Data $paymentHelper,
53  array $data = []
54  ) {
55  $this->_paymentHelper = $paymentHelper;
56  $this->_coreRegistry = $registry;
57  $this->httpContext = $httpContext;
58  parent::__construct($context, $data);
59  $this->_isScopePrivate = true;
60  }
61 
65  protected function _prepareLayout()
66  {
67  $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId()));
68  $infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout());
69  $this->setChild('payment_info', $infoBlock);
70  }
71 
75  public function getPaymentInfoHtml()
76  {
77  return $this->getChildHtml('payment_info');
78  }
79 
85  public function getOrder()
86  {
87  return $this->_coreRegistry->registry('current_order');
88  }
89 
95  public function getBackUrl()
96  {
97  if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
98  return $this->getUrl('*/*/history');
99  }
100  return $this->getUrl('*/*/form');
101  }
102 
108  public function getBackTitle()
109  {
110  if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
111  return __('Back to My Orders');
112  }
113  return __('View Another Order');
114  }
115 
120  public function getInvoiceUrl($order)
121  {
122  return $this->getUrl('*/*/invoice', ['order_id' => $order->getId()]);
123  }
124 
129  public function getShipmentUrl($order)
130  {
131  return $this->getUrl('*/*/shipment', ['order_id' => $order->getId()]);
132  }
133 
138  public function getCreditmemoUrl($order)
139  {
140  return $this->getUrl('*/*/creditmemo', ['order_id' => $order->getId()]);
141  }
142 }
$order
Definition: order.php:55
__()
Definition: __.php:13
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Http\Context $httpContext, \Magento\Payment\Helper\Data $paymentHelper, array $data=[])
Definition: View.php:48