cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.3 order comment block not rendering properly

Magento 2.3 order comment block not rendering properly

I am working on Marketplace extension they are not providing order comment block. that's why I am going to customize this.

Right now, Comment history block appearing properly. also, comment has been added to the order with notified mail.

after submitting a comment, the block should be rendered with the latest comment but in my case not.

It will display Magento black page.

The following code has been added.

<?php
namespace Webkul\Marketplace\Block\Order\View;

use Magento\Sales\Block\Adminhtml\Order\View\History as OrderHistory;
class History extends OrderHistory
{
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Sales\Helper\Data $salesData,
        \Magento\Framework\Registry $registry,
        \Magento\Sales\Helper\Admin $adminHelper,
        array $data = []
    ) {
        parent::__construct($context, $salesData, $registry, $adminHelper);
    }
    public function canAddComment()
    {
        return true;
    }
    public function canSendCommentEmail()
    {
        return true;
    }
    protected function _prepareLayout()
    {
        $onclick = "submitAndReloadArea($('order_history_block').parentNode, '" . $this->getSubmitUrl() . "')";
        $button = $this->getLayout()->createBlock(
            \Magento\Backend\Block\Widget\Button::class
        )->setData(
            ['label' => __('Submit '), 'class' => 'action-save action-secondary', 'onclick' => $onclick]
        );
        $this->setChild('submit_button', $button);
        //return parent::_prepareLayout();
        return $this;
    }
}

order_history_block this is html div element id which is in present in .phtml