_checkoutSession = $checkoutSession; $this->_orderConfig = $orderConfig; $this->_isScopePrivate = true; $this->httpContext = $httpContext; } /** * Render additional order information lines and return result html * * @return string */ public function getAdditionalInfoHtml() { return $this->_layout->renderElement('order.success.additional.info'); } /** * Initialize data and prepare it for output * * @return string */ protected function _beforeToHtml() { $this->prepareBlockData(); return parent::_beforeToHtml(); } /** * Prepares block data * * @return void */ protected function prepareBlockData() { $order = $this->_checkoutSession->getLastRealOrder(); $this->addData( [ 'is_order_visible' => $this->isVisible($order), 'view_order_url' => $this->getUrl( 'sales/order/view/', ['order_id' => $order->getEntityId()] ), 'print_url' => $this->getUrl( 'sales/order/print', ['order_id' => $order->getEntityId()] ), 'can_print_order' => $this->isVisible($order), 'can_view_order' => $this->canViewOrder($order), 'order_id' => $order->getIncrementId() ] ); } /** * Is order visible * * @param Order $order * @return bool */ protected function isVisible(Order $order) { return !in_array( $order->getStatus(), $this->_orderConfig->getInvisibleOnFrontStatuses() ); } /** * Can view order * * @param Order $order * @return bool */ protected function canViewOrder(Order $order) { return $this->httpContext->getValue(Context::CONTEXT_AUTH) && $this->isVisible($order); } /** * @return string * @since 100.2.0 */ public function getContinueUrl() { return $this->_storeManager->getStore()->getBaseUrl(); } }