1

help needed i am creating a factory in block and get data from model it give result in block but when i return this factory and use this block function in phtml file it give error " Fatal error: Uncaught Error: Call to a member function dispatch() on null in C:\wamp64\www\hum\vendor\magento\framework\View\Element\AbstractBlock.php on line 652 " enter image description here

asked May 11, 2019 at 18:28

1 Answer 1

0

You should return following code:

return parent::_prepareLayout();

So _prepareLayout method looks like:

protected function _prepareLayout()
{
 // your modification
 return parent::_prepareLayout();
}
answered May 11, 2019 at 20:11
2
  • no , i find a mistake myself , i used _construct istead of __construct :) Commented May 12, 2019 at 17:12
  • But you didn't update your question regarding that. Also, you must apply changes according to my answer as well. Commented May 13, 2019 at 4:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.