3

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?

2
  • Are you getting any JavaScript errors ? Commented 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 know Commented Apr 8, 2018 at 13:05

3 Answers 3

0

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.

0
use Magento\Framework\Exception\CouldNotSaveException;


 if(false){
            throw new CouldNotSaveException(__('Error Message'));
           }
0

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>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.