messageManager addSuccessMessage/addErrorMessage set cookies?Erratic cookie-related login problemCan not delete notifications or messages from the admin notifications inboxSession and cookies are not removing in MagentoWhy does Magento remove my frontend cookie after using customer/sessionHow to Set Session Cookie Based on Query-String Param in MagentoHow can I set an explicit cookie domain and still loginCookie issue with Internet ExplorerM2: Issue with mage-messages cookieRemove notification messages on refreshIssue with mage-messages cookie in iphone safari

Can I rely on this github repository files?

Greatest common substring

Can I use my Chinese passport to enter China after I acquired another citizenship?

Is it improper etiquette to ask your opponent what his/her rating is before the game?

Generating adjacency matrices from isomorphic graphs

Why is Arduino resetting while driving motors?

Flux received by a negative charge

Sampling Theorem and reconstruction

Divine apple island

Are all species of CANNA edible?

Can someone explain how this makes sense electrically?

Is there a word to describe the feeling of being transfixed out of horror?

Diode in opposite direction?

Will adding a BY-SA image to a blog post make the entire post BY-SA?

Greco-Roman egalitarianism

Customize circled numbers

Difference between -| and |- in TikZ

A social experiment. What is the worst that can happen?

Some numbers are more equivalent than others

Is XSS in canonical link possible?

MAXDOP Settings for SQL Server 2014

Melting point of aspirin, contradicting sources

Structured binding on const

What does this horizontal bar at the first measure mean?



messageManager addSuccessMessage/addErrorMessage set cookies?


Erratic cookie-related login problemCan not delete notifications or messages from the admin notifications inboxSession and cookies are not removing in MagentoWhy does Magento remove my frontend cookie after using customer/sessionHow to Set Session Cookie Based on Query-String Param in MagentoHow can I set an explicit cookie domain and still loginCookie issue with Internet ExplorerM2: Issue with mage-messages cookieRemove notification messages on refreshIssue with mage-messages cookie in iphone safari













1















Whenever I addSuccessMessage/addErrorMessage it sets the cookie?
But I am not able to get that code, where that magic happens.



In messages.js
it gets that message by using code



$.cookieStorage.get('mage-messages');


In my case, once it set the cookieStorage it doesn't get clear even though I do it my code at the end of the script.



$.cookieStorage.set('mage-messages', '');









share|improve this question






















  • You have raised a good point. +1 for that

    – Shoaib Munir
    yesterday















1















Whenever I addSuccessMessage/addErrorMessage it sets the cookie?
But I am not able to get that code, where that magic happens.



In messages.js
it gets that message by using code



$.cookieStorage.get('mage-messages');


In my case, once it set the cookieStorage it doesn't get clear even though I do it my code at the end of the script.



$.cookieStorage.set('mage-messages', '');









share|improve this question






















  • You have raised a good point. +1 for that

    – Shoaib Munir
    yesterday













1












1








1








Whenever I addSuccessMessage/addErrorMessage it sets the cookie?
But I am not able to get that code, where that magic happens.



In messages.js
it gets that message by using code



$.cookieStorage.get('mage-messages');


In my case, once it set the cookieStorage it doesn't get clear even though I do it my code at the end of the script.



$.cookieStorage.set('mage-messages', '');









share|improve this question














Whenever I addSuccessMessage/addErrorMessage it sets the cookie?
But I am not able to get that code, where that magic happens.



In messages.js
it gets that message by using code



$.cookieStorage.get('mage-messages');


In my case, once it set the cookieStorage it doesn't get clear even though I do it my code at the end of the script.



$.cookieStorage.set('mage-messages', '');






magento2 cookie messages notification iphone






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









summusummu

3259




3259












  • You have raised a good point. +1 for that

    – Shoaib Munir
    yesterday

















  • You have raised a good point. +1 for that

    – Shoaib Munir
    yesterday
















You have raised a good point. +1 for that

– Shoaib Munir
yesterday





You have raised a good point. +1 for that

– Shoaib Munir
yesterday










2 Answers
2






active

oldest

votes


















0














Success and error messages stores in customer data, you can always get and set customer data



require(['Magento_Customer/js/customer-data'], function(customerData)
customerData.set('messages', messages: "");
);


This will empty data of messages in customer data.






share|improve this answer























  • then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

    – summu
    yesterday











  • Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

    – Shoaib Munir
    yesterday











  • In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

    – summu
    yesterday











  • Check removeAll function in messages.js you will understand

    – Shoaib Munir
    yesterday











  • look for customerData in entire messages.js it will surely clear stuff about customerData

    – Shoaib Munir
    yesterday


















0














I have also faced this similar issue and I got this resolved by implementing complex messages, like this:



Also you can include any custom html in any message also with this technique.



Implementing complex messages:




  1. in modules di.xml:



    enter image description here




  2. Trigger complex message insteed of simple message:



    $this->_messageManager->addComplexSuccessMessage('custom_rfq_success');



  3. create .phtml containing message content:
    at (/Namespace/Module/view/frontend/templates/messages/custom_rfq_success.phtml)


Just notice in the above of .phtml file having message content apply this:



<script type="text/javascript">
require(['jquery','domReady!'], function($)
setTimeout(function()

$.cookieStorage.set('mage-messages', '');
, 1000);
)
</script>


I was able to resolve that sticky message issue by this. Please check if it works well for you.



More information on complex messages:
https://store.fooman.co.nz/blog/displaying-complex-error-messages-in-magento-2.html



Thanks.






share|improve this answer

























  • I need to put that each module di.xml? that's a pain

    – summu
    15 hours ago











  • Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

    – summu
    15 hours ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267104%2fmessagemanager-addsuccessmessage-adderrormessage-set-cookies%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Success and error messages stores in customer data, you can always get and set customer data



require(['Magento_Customer/js/customer-data'], function(customerData)
customerData.set('messages', messages: "");
);


This will empty data of messages in customer data.






share|improve this answer























  • then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

    – summu
    yesterday











  • Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

    – Shoaib Munir
    yesterday











  • In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

    – summu
    yesterday











  • Check removeAll function in messages.js you will understand

    – Shoaib Munir
    yesterday











  • look for customerData in entire messages.js it will surely clear stuff about customerData

    – Shoaib Munir
    yesterday















0














Success and error messages stores in customer data, you can always get and set customer data



require(['Magento_Customer/js/customer-data'], function(customerData)
customerData.set('messages', messages: "");
);


This will empty data of messages in customer data.






share|improve this answer























  • then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

    – summu
    yesterday











  • Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

    – Shoaib Munir
    yesterday











  • In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

    – summu
    yesterday











  • Check removeAll function in messages.js you will understand

    – Shoaib Munir
    yesterday











  • look for customerData in entire messages.js it will surely clear stuff about customerData

    – Shoaib Munir
    yesterday













0












0








0







Success and error messages stores in customer data, you can always get and set customer data



require(['Magento_Customer/js/customer-data'], function(customerData)
customerData.set('messages', messages: "");
);


This will empty data of messages in customer data.






share|improve this answer













Success and error messages stores in customer data, you can always get and set customer data



require(['Magento_Customer/js/customer-data'], function(customerData)
customerData.set('messages', messages: "");
);


This will empty data of messages in customer data.







share|improve this answer












share|improve this answer



share|improve this answer










answered yesterday









Shoaib MunirShoaib Munir

2,2231828




2,2231828












  • then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

    – summu
    yesterday











  • Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

    – Shoaib Munir
    yesterday











  • In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

    – summu
    yesterday











  • Check removeAll function in messages.js you will understand

    – Shoaib Munir
    yesterday











  • look for customerData in entire messages.js it will surely clear stuff about customerData

    – Shoaib Munir
    yesterday

















  • then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

    – summu
    yesterday











  • Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

    – Shoaib Munir
    yesterday











  • In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

    – summu
    yesterday











  • Check removeAll function in messages.js you will understand

    – Shoaib Munir
    yesterday











  • look for customerData in entire messages.js it will surely clear stuff about customerData

    – Shoaib Munir
    yesterday
















then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

– summu
yesterday





then why in message.js message get and set from mage-messages cookie , in my case it shows all previous cookie messages even though I clear it using $cookieStorage('mage-messages',"") , for iPhone safari it's totally not working

– summu
yesterday













Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

– Shoaib Munir
yesterday





Magento not just save messages in cookie, it also saves in local storage of your browser, check local storage and you will see, by using the method that I have mentioned, you will able to empty your local storage messages

– Shoaib Munir
yesterday













In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

– summu
yesterday





In message.phtml also it gets data from cookieMessages <div data-bind="foreach: data: cookieMessages, as: 'message' " class="messages">, which we get from cookieStorage , i dont see any role of customerData here

– summu
yesterday













Check removeAll function in messages.js you will understand

– Shoaib Munir
yesterday





Check removeAll function in messages.js you will understand

– Shoaib Munir
yesterday













look for customerData in entire messages.js it will surely clear stuff about customerData

– Shoaib Munir
yesterday





look for customerData in entire messages.js it will surely clear stuff about customerData

– Shoaib Munir
yesterday













0














I have also faced this similar issue and I got this resolved by implementing complex messages, like this:



Also you can include any custom html in any message also with this technique.



Implementing complex messages:




  1. in modules di.xml:



    enter image description here




  2. Trigger complex message insteed of simple message:



    $this->_messageManager->addComplexSuccessMessage('custom_rfq_success');



  3. create .phtml containing message content:
    at (/Namespace/Module/view/frontend/templates/messages/custom_rfq_success.phtml)


Just notice in the above of .phtml file having message content apply this:



<script type="text/javascript">
require(['jquery','domReady!'], function($)
setTimeout(function()

$.cookieStorage.set('mage-messages', '');
, 1000);
)
</script>


I was able to resolve that sticky message issue by this. Please check if it works well for you.



More information on complex messages:
https://store.fooman.co.nz/blog/displaying-complex-error-messages-in-magento-2.html



Thanks.






share|improve this answer

























  • I need to put that each module di.xml? that's a pain

    – summu
    15 hours ago











  • Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

    – summu
    15 hours ago
















0














I have also faced this similar issue and I got this resolved by implementing complex messages, like this:



Also you can include any custom html in any message also with this technique.



Implementing complex messages:




  1. in modules di.xml:



    enter image description here




  2. Trigger complex message insteed of simple message:



    $this->_messageManager->addComplexSuccessMessage('custom_rfq_success');



  3. create .phtml containing message content:
    at (/Namespace/Module/view/frontend/templates/messages/custom_rfq_success.phtml)


Just notice in the above of .phtml file having message content apply this:



<script type="text/javascript">
require(['jquery','domReady!'], function($)
setTimeout(function()

$.cookieStorage.set('mage-messages', '');
, 1000);
)
</script>


I was able to resolve that sticky message issue by this. Please check if it works well for you.



More information on complex messages:
https://store.fooman.co.nz/blog/displaying-complex-error-messages-in-magento-2.html



Thanks.






share|improve this answer

























  • I need to put that each module di.xml? that's a pain

    – summu
    15 hours ago











  • Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

    – summu
    15 hours ago














0












0








0







I have also faced this similar issue and I got this resolved by implementing complex messages, like this:



Also you can include any custom html in any message also with this technique.



Implementing complex messages:




  1. in modules di.xml:



    enter image description here




  2. Trigger complex message insteed of simple message:



    $this->_messageManager->addComplexSuccessMessage('custom_rfq_success');



  3. create .phtml containing message content:
    at (/Namespace/Module/view/frontend/templates/messages/custom_rfq_success.phtml)


Just notice in the above of .phtml file having message content apply this:



<script type="text/javascript">
require(['jquery','domReady!'], function($)
setTimeout(function()

$.cookieStorage.set('mage-messages', '');
, 1000);
)
</script>


I was able to resolve that sticky message issue by this. Please check if it works well for you.



More information on complex messages:
https://store.fooman.co.nz/blog/displaying-complex-error-messages-in-magento-2.html



Thanks.






share|improve this answer















I have also faced this similar issue and I got this resolved by implementing complex messages, like this:



Also you can include any custom html in any message also with this technique.



Implementing complex messages:




  1. in modules di.xml:



    enter image description here




  2. Trigger complex message insteed of simple message:



    $this->_messageManager->addComplexSuccessMessage('custom_rfq_success');



  3. create .phtml containing message content:
    at (/Namespace/Module/view/frontend/templates/messages/custom_rfq_success.phtml)


Just notice in the above of .phtml file having message content apply this:



<script type="text/javascript">
require(['jquery','domReady!'], function($)
setTimeout(function()

$.cookieStorage.set('mage-messages', '');
, 1000);
)
</script>


I was able to resolve that sticky message issue by this. Please check if it works well for you.



More information on complex messages:
https://store.fooman.co.nz/blog/displaying-complex-error-messages-in-magento-2.html



Thanks.







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered yesterday









Narendra VyasNarendra Vyas

30711




30711












  • I need to put that each module di.xml? that's a pain

    – summu
    15 hours ago











  • Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

    – summu
    15 hours ago


















  • I need to put that each module di.xml? that's a pain

    – summu
    15 hours ago











  • Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

    – summu
    15 hours ago

















I need to put that each module di.xml? that's a pain

– summu
15 hours ago





I need to put that each module di.xml? that's a pain

– summu
15 hours ago













Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

– summu
15 hours ago






Can i write the message.phtml content in my custom_rfq_success.phtml, as i need same format, but message.phtml has data-bind and ko stuff (knockout)

– summu
15 hours ago


















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267104%2fmessagemanager-addsuccessmessage-adderrormessage-set-cookies%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Sum ergo cogito? 1 nng

三茅街道4182Guuntc Dn precexpngmageondP