addressRenderer = $addressRenderer; $this->_paymentHelper = $paymentHelper; $this->_coreRegistry = $registry; parent::__construct($context, $data); } /** * @return void */ protected function _prepareLayout() { $this->pageConfig->getTitle()->set(__('Order # %1', $this->getOrder()->getRealOrderId())); $infoBlock = $this->_paymentHelper->getInfoBlock($this->getOrder()->getPayment(), $this->getLayout()); $this->setChild('payment_info', $infoBlock); } /** * @return string */ public function getBackUrl() { return $this->getUrl('*/*/history'); } /** * @return string */ public function getPrintUrl() { return $this->getUrl('*/*/print'); } /** * @return string */ public function getPaymentInfoHtml() { return $this->getChildHtml('payment_info'); } /** * @return array|null */ public function getOrder() { return $this->_coreRegistry->registry('current_order'); } /** * @return array|null */ public function getInvoice() { return $this->_coreRegistry->registry('current_invoice'); } /** * @param AbstractBlock $renderer * @return $this */ protected function _prepareItem(AbstractBlock $renderer) { $renderer->setPrintStatus(true); return parent::_prepareItem($renderer); } /** * Get html of invoice totals block * * @param \Magento\Sales\Model\Order\Invoice $invoice * @return string */ public function getInvoiceTotalsHtml($invoice) { $html = ''; $totals = $this->getChildBlock('invoice_totals'); if ($totals) { $totals->setInvoice($invoice); $html = $totals->toHtml(); } return $html; } /** * Formats order address to html, pdf and etc. formats * * @param \Magento\Sales\Model\Order\Address $address * @param string $format * @return null|string */ public function formatAddress(\Magento\Sales\Model\Order\Address $address, $format) { return $this->addressRenderer->format($address, $format); } }