In magento 2 is there any way to create same order view page in custom module? I want to create a custom order view page where I have to display some more data but not want to display on core (order view page). So for that I need to create a custom a page same as order view page

1 Answer 1


Step 1:

Create frontname_controllerdirectory_controllerclass.xml inside your module view/adminhtml/layout

Then copy all the layout of sales_order_view.xml from vendor/magento/module-sales/view/adminhtml/layout

Then add custom block or your logic you want to implement and create redirect to your link frontname_controllerdirectory_controllerclass and create View.php class inside Controller/Adminhtml then define

namespace Namespace\ModuleName\Controller\Adminhtml\Order;

use Magento\Backend\App\Action;

class View extends \Magento\Sales\Controller\Adminhtml\Order
    const ADMIN_RESOURCE = 'Namespace_ModuleName::actions_view';

    const PAGE_TITLE = 'Add page title here';

    public function execute()
        $order = $this->_initOrder();
        $resultRedirect = $this->resultRedirectFactory->create();
        if ($order) {
            try {
                $resultPage = $this->_initAction();
                $resultPage->getConfig()->getTitle()->prepend(__('Page title'));
            } catch (\Exception $e) {
                $this->messageManager->addErrorMessage(__('Exception occurred during order load'));
                return $resultRedirect;
            $resultPage->getConfig()->getTitle()->prepend(sprintf("#%s", $order->getIncrementId()));
            return $resultPage;
        return $resultRedirect;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.