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.

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(
            ['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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.