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;
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论