-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The famous <ul id="admin_messages">MESSAGE HERE</ul> #940
Comments
I think the fix for this issue is in the devel branch. How did you get Turpentine? Can you please download the devel branch and see if the error persists? |
Nope, I will explain. Ihave installed it using git, I have switched to devel branch now and.
<reference name="global_messages">
<action method="setEsiOptions">
<params>
<method>ajax</method>
<access>private</access>
<flush_events>
<core_session_abstract_add_message/>
</flush_events>
<only_cache_if>empty</only_cache_if>
</params>
</action>
</reference>
<reference name="messages">
<action method="setEsiOptions">
<params>
<method>ajax</method>
<access>private</access>
<flush_events>
<core_session_abstract_add_message/>
</flush_events>
<only_cache_if>empty</only_cache_if>
</params>
</action>
</reference> The block refreshes with ajax and creates this code <div class="col-main">
<!-- AJAX START [global_messages] -->
<div id="turpentine-esi-block-adcb2807a97f6084b951516cc1890a79b7339481fbdcdf10f65fafb6767fce9a"><ul id="admin_messages">Tu opinión ha sido aceptada y enviada para su revisión.</ul></div><!-- AJAX END [global_messages] -->
<div id="newsletterajax"></div>
<script type="text/javascript">
var optionsPrice = new Product.OptionsPrice([]);
</script>
<div id="messages_product_view"><!-- AJAX START [messages] -->
<div id="turpentine-esi-block-59d82f41339ead2a8c2f6d7c21156b41f23f11c47d56b0013c11ff11bd74dd61"></div><!-- AJAX END [messages] -->
</div> The HTML is wrong the generated message is <ul id="admin_messages">Tu opinión ha sido aceptada y enviada para su revisión.</ul> The generated html is <ul class="messages"><li class="success-msg"><ul><li><span>Tu opinión ha sido aceptada y enviada para su revisión.</span></li></ul></li></ul> Its ok, but the content is cached and there is no way to refresh it, everytime I visit the product, I get the message
<ul class="messages"><li class="success-msg"><ul><li><span>Tu opinión ha sido aceptada y enviada para su revisión.</span></li></ul></li></ul> But, again, I see the message everytime. It never refreshes <reference name="global_messages">
<action method="setEsiOptions">
<params>
<method>esi</method>
<access>private</access>
<flush_events>
<core_session_abstract_add_message/>
</flush_events>
<only_cache_if>no_text</only_cache_if>
</params>
</action>
</reference>
<reference name="messages">
<action method="setEsiOptions">
<params>
<method>esi</method>
<access>private</access>
<flush_events>
<core_session_abstract_add_message/>
</flush_events>
<only_cache_if>no_text</only_cache_if>
</params>
</action>
</reference> Note the change in "only_cache_if" section <ttl>0</ttl> But the cache never refreshes It only refreshes cache if you set method to AJAX and Enable AJAX Flash Messages, but it returns incorrect HTMl as in master branch. |
One more and I think only one is needed |
I discovered how it works. <ul id="admin_messages">MESSAGE HERE</ul> And also cache the result |
@miguelbalparda sorry Miguel, just to know. Is there any fix or any plan to fix it? |
We work hard to fix all the issues. It seems to be you are the only one experiencing this issue for now, so I wouldn’t say the extension can't be used. |
Ok, I only want to know if it's only me the one with the problem. |
Nope, you aren't the only one. getting same. In my case I have multiple texts there and they are in content following each other without html-tags. |
Try adding another flush event to clear the cache when new products are added:
Additionally, do you know steps to replicate this on default install/theme? |
Actually this is core bug --- app/code/core/Mage/Core/Block/Messages-o.php 2015-10-13 20:35:25.000000000 +0000
+++ app/code/core/Mage/Core/Block/Messages.php 2015-10-13 20:40:49.000000000 +0000
@@ -213,7 +213,7 @@
$html = '<' . $this->_messagesFirstLevelTagName . ' id="admin_messages">';
foreach ($this->getMessages($type) as $message) {
$html.= '<' . $this->_messagesSecondLevelTagName . ' class="'.$message->getType().'-msg">'
- . ($this->_escapeMessageFlag) ? $this->escapeHtml($message->getText()) : $message->getText()
+ . ($this->_escapeMessageFlag ? $this->escapeHtml($message->getText()) : $message->getText())
. '</' . $this->_messagesSecondLevelTagName . '>';
}
$html .= '</' . $this->_messagesFirstLevelTagName . '>'; Question might be why Turpentine uses "admin_messages" container and when Turpentine is off then this is not being used. |
Having the same issues.. The following I tried:
<reference name="global_messages">
<action method="setEsiOptions">
<params>
<access>private</access>
<ttl>1</ttl>
<method>esi</method>
<scope>page</scope>
<flush_events>
<controller_action_predispatch/>
</flush_events>
</params>
</action>
</reference>
<reference name="messages">
<action method="setEsiOptions">
<params>
<access>private</access>
<ttl>1</ttl>
<method>esi</method>
<scope>page</scope>
<flush_events>
<controller_action_predispatch/>
</flush_events>
</params>
</action>
</reference> @elfeffe Did you manage to fix it? |
@elfeffe: You are not alone. I got this issue on "Orders and Returns" page too. The error message when you fill in wrong the form doesn't have the correct Magento css style. I checked the source code and there is a different ul tag used which creates trouble, the one you mentioned in your first post. Please see the images bellow, first the visual style of the tag and how is source code of the page. This is a VM without Varnish/Turpentine installed: This is a VM with Varnish/Turpentine installed: |
I got my messages working! This is what I did. From the docs I quote:
Since neither the block But, we want to define caching policies though. We want it to be dynamic, so we need some wrapper around it. The solution: In my local.xml <default>
<reference name="root">
<action method="unsetChild">
<name>global_messages</name>
</action>
<action method="unsetChild">
<name>messages</name>
</action>
<block type="core/template" name="message_wrapper" as="message_wrapper" template="custom/message-wrapper.phtml">
<action method="setEsiOptions">
<params>
<access>private</access>
<scope>page</scope>
<ttl>0</ttl>
</params>
</action>
<block type="core/messages" name="global_messages" as="global_messages"/>
<block type="core/messages" name="messages" as="messages"/>
</block>
</reference>
</default> And in my custom/message-wrapper.phtml <div class="messages-wrapper">
<?php
echo $this->getChildHtml('global_messages');
echo $this->getChildHtml('messages');
?>
</div> |
@Desmaster your solution is not working for me. I placed local.xml in my theme layout folder, then custom/message-wrapper.phtml in template. I flushed the cache, restarted varnish, none worked. Could you please give more details about file locations and changes? |
Make sure you output the defined block in the root templates( |
@Desmaster. I followed all your steps and I could not fix it.
<div class="col-xs-12">
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
<div class="col-main">
<div class="padding-s">
<?php echo $this->getChildHtml('global_messages') ?>
<?php echo $this->getChildHtml('content') ?>
</div>
</div>
</div>
</div> In line 51 getChildHtml('global_messages') ?> I replaced global_messages with message_wrapper. I flushed the cache and restarted Varnish but there is no positive result, same behavior. To find out if this is the right template file I commented the whole line 51 and the message is not appearing, so this was the right template for editing. I am getting this issue in "Orders and Returns" page here is a screenshot: |
@elvin-vaimo was right. I've made that change in Magento core files and here is the result: Even it is an error message its class it is "admin_messages" instead of "messages". See how the containers are bonded together. Do a test with login form. You will get this html tag for an error: <ul class="messages">
<li class="error-msg">
<ul><li><span>Invalid login or password.</span></li></ul>
</li>
</ul> I would like to know as @elvin-vaimo " why Turpentine uses "admin_messages" container and when Turpentine is off then this is not being used". |
@miguelbalparda Sorry to bother you Miguel, but you can see I'm not the onlyone with this problem |
+1 Also having this issue |
I'd like to take a look at this. Can anyone give me steps to replicate on a default store? I'd like to rule out that it's theme-specific. |
Check my posts. |
@addison74 Hello, was wondering what changes you made to Magento's core files in order to correctly display the error messages? I am currently looking at Messages.php in the core files. |
Check this one: #940 (comment). It is like taking an ax and killing a pig. For the moment it is some kind a bandage. It is not a proper solution, a more elegant one should come from Turpentine module. |
We had the same problem and saw that messages were being stashed in Hope that helps anyone. |
+1 |
We face the same issue when a customer subscribes for the newsletter in our footer. The message is not displayed like a usual magento success message, but as an admin_message. And here is the thing, we do not really understand. Disabling turpentine one can see, that usually Does anyone have an idea, why this decision is implemented the way it is? |
@norgeindian , see #940 (comment) to fix the core bug there on M1. |
@elvinristi , thanks for the hint, but did not work for me. Faced the same issue. |
Am not really sure why this was coded like this, what would be a better way to do it? |
@aheadley , as far as I can see it was you who wrote most of the code in these functions. Could you explain the reasons for that? |
There is a proposed fix for this in #1508, care to check and report back? |
If you could include this fix, this would be great and in my eyes we could then close this issue. |
fixed admin_messages in frontend, fixes #940
I have Magento 1.9.1 and Turpentine 0.6.5, with Ultimo Theme.
And I have the same issue as some people had #112 #153. But that issues are from 2013, I don't believe they are not fixed yet.
When I post a review I get
Is there any way to fix this?
I don't have that error if I disable Turpentine.
My turpentine_esi.xml looks like
Any help will be really appretiated, I'm getting crazy with this.
The text was updated successfully, but these errors were encountered: