1

we have a Contact Us form that is used for customer to enter questions/comments. Although the email is sent out there is no confirmation page that says something like "Your message has been sent". Is there anyway to add this?

thanks! Ahdee

1 Answer 1

1

Check there has any message object like this.

If not then added in your controller after sending message.

For success:


$this->messageManager->addSuccess(
    __('Your message has been sent')
);

For error:


$this->messageManager->addError(
    __('We can\'t process your request right now. Sorry, that\'s all we know.')
);
3
  • thank you. However, where can I find this controller file? I'm using the default contact us page I believe.
    – Ahdee
    Sep 24, 2017 at 5:07
  • Actually, I located the file, ..vendor/magento/module-contact/Controller/Index/Post.php; its probably bad form to edit Magento's core files but I don't know how to redirect this. I found the addSuccess part however, strangely it is there; its just not showing up. So what I ended up doing was redirecting to a cms page and not only did it work but the green message field showed up this time. This was my one line of code a modified to, $this->_redirect('contactus');
    – Ahdee
    Sep 24, 2017 at 5:39
  • It's missing part in your theme. There must be missing message container.
    – Sohel Rana
    Sep 24, 2017 at 5:41

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.