_coreRegistry = $registry; $this->httpContext = $httpContext; parent::__construct($context, $data); $this->_isScopePrivate = true; } /** * Retrieve current order model instance * * @return \Magento\Sales\Model\Order */ public function getOrder() { return $this->_coreRegistry->registry('current_order'); } /** * Get url for printing order * * @param \Magento\Sales\Model\Order $order * @return string */ public function getPrintUrl($order) { if (!$this->httpContext->getValue(Context::CONTEXT_AUTH)) { return $this->getUrl('sales/guest/print', ['order_id' => $order->getId()]); } return $this->getUrl('sales/order/print', ['order_id' => $order->getId()]); } /** * Get url for reorder action * * @param \Magento\Sales\Model\Order $order * @return string */ public function getReorderUrl($order) { if (!$this->httpContext->getValue(Context::CONTEXT_AUTH)) { return $this->getUrl('sales/guest/reorder', ['order_id' => $order->getId()]); } return $this->getUrl('sales/order/reorder', ['order_id' => $order->getId()]); } }