Timeline for send Observer data to phtml file in Magento 2
Current License: CC BY-SA 4.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 30, 2022 at 19:15 | comment | added | Dolly | @Msquare,If I add or echo anything in observer, I get this error: prnt.sc/z94fRrJx5M27. I tried with your way and $layout = $this->layoutFactory->create(); $block = $layout->createBlock('Magento\Framework\View\Element\Template')->setTemplate('ABCD_XYZ::custom.phtml'); $response = $observer->getEvent()->getData('response'); $response ->setHeader('Content-Type','text/html') ->setBody($block->toHtml()); | |
Nov 6, 2020 at 9:17 | comment | added | Jafar Pinjar | hi @Msquare why two events here? | |
Nov 6, 2020 at 7:11 | history | bounty ended | Jafar Pinjar | ||
Nov 6, 2020 at 7:11 | vote | accept | Jafar Pinjar | ||
Nov 4, 2020 at 6:58 | comment | added | Jafar Pinjar | Need to avoid page refresh, @mahesh, as i am loading template file in every pages | |
Nov 4, 2020 at 4:55 | comment | added | Msquare | now data are update after page refresh please check and update me. | |
Nov 4, 2020 at 4:48 | history | edited | Msquare | CC BY-SA 4.0 |
Update answer
|
Nov 4, 2020 at 4:30 | history | edited | Msquare | CC BY-SA 4.0 |
deleted 41 characters in body
|
Nov 3, 2020 at 16:12 | comment | added | Jafar Pinjar | yes checked it, page is getting refreshed on observer call, so $data getting empty on refresh | |
Nov 3, 2020 at 9:56 | comment | added | Msquare | Have you checked @jafarpinjar ? | |
Nov 3, 2020 at 9:19 | history | edited | Msquare | CC BY-SA 4.0 |
Update answer
|
Nov 3, 2020 at 9:05 | comment | added | Msquare | i update file please check and update me. | |
Nov 3, 2020 at 9:04 | history | edited | Msquare | CC BY-SA 4.0 |
Update answer
|
Nov 3, 2020 at 9:01 | comment | added | Jafar Pinjar | hi @msquare, yes i checked it, console its not printing | |
Nov 3, 2020 at 4:35 | comment | added | Msquare | @jafarpinjar check into console observe data are printed. please check and update me.. | |
Nov 3, 2020 at 4:33 | history | edited | Msquare | CC BY-SA 4.0 |
Update answer
|
Nov 3, 2020 at 1:49 | comment | added | Jafar Pinjar | Hi @msquare, yes I can get observer data in phtml but the JavaScript written in phtml not working, pls check my question. | |
Nov 2, 2020 at 17:27 | history | answered | Msquare | CC BY-SA 4.0 |