After Magento upgrades to its latest version, no success and error messages are seen to be added on the page message section while submitting the newsletter.
But the email gets saved on to the backend
It shows a message when reverted to luma but doesn't work on a custom theme. It was working fine before the update.
Can anyone suggest what might have caused the issue after update?
-
Are you getting any JavaScript errors ?Kalyan Chakravarthi V– Kalyan Chakravarthi V2018年02月13日 17:05:59 +00:00Commented Feb 13, 2018 at 17:05
-
check your console, if any error is there or not, if no error then try to see network tab in inspect and search 'section' how many time section got trigger and each section see, i am sure one of working fine but next section update clearing your message. if any update let me knowKanhaiya lal– Kanhaiya lal2018年04月08日 13:05:35 +00:00Commented Apr 8, 2018 at 13:05
3 Answers 3
For me this issue was being caused by the message block not being present on the page. Try loading other pages that you have modified less.
use Magento\Framework\Exception\CouldNotSaveException;
if(false){
throw new CouldNotSaveException(__('Error Message'));
}
first you need to add flash massage if (false)
{
throw new CouldNotSaveException(__('Error Message'));
$this->messageManager->addErrorMessage("Somthing went wrong ");
} else {
$this->messageManager->addSuccessMessage("record add successfully!");
}
second :- check your layout.xml include massage block
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Messages" name="messages" as="messages" template="Magento_Theme::messages.phtml"/>
</body>