Uncaught Error: Call to a member function dispatch() on null

主要問題是由於構造函數的類沒有繼承父類,須要更新構造函數以下:函數

public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    \Magento\Customer\Model\Session $customerSession,  
    \Magento\Framework\ObjectManagerInterface $objectManager,
    array $data = []
 ) {
    parent::__construct($context, $data);
    $this->customerSession = $customerSession;
    $this->_objectManager = $objectManager;
  }
相關文章
相關標籤/搜索