cancel
Showing results for 
Search instead for 
Did you mean: 

Static blocks are mixed between store views after upgrading to v.1.9.2.

SOLVED

Static blocks are mixed between store views after upgrading to v.1.9.2.

Hi,

after upgrading to v.1.9.2 all pages loading static blocks, are loaded with the static block version that firstly loaded, regardless the store view we are running.

Ex i have a message block in various languages, one for each store view, but now all store views are loading the block that was firstly loaded.

The problem can be solved by disabling "blocks HTML output" cache.

I heard that there are some changes related with the way that magento caching static blocks in version 1.9.2.

Is there anywere a fix or information

 

Hello everybody.

there is a patch that i tested and working fine

http://community.magento.com/t5/Technical-Issues/CMS-Caching-Issues-With-Magento-CE-1-9-2-0/m-p/1087...

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Static blocks are mixed between store views after upgrading to v.1.9.2.

5 REPLIES 5

Re: Static blocks are mixed between store views after upgrading to v.1.9.2.

I'm glad it's not just me then. Something is definitely broken in the static block caching - I only have one store view but I was getting mixed up pages (all static/CMS content) from the header down on my category roots following the upgrade, so I stripped the test site back to essentially a bare installation before realising it was Magento's internal caching that broke rather than Lesti FPC or any other extensions/mods that could potentially cause issues like this... As a result I've learned that when using Lesti FPC with a Redis backend, the site doesn't actually respond any slower with the HTML output cache off, so I guess it's no big issue besides the half a day I wasted chasing the problem down.

Re: Static blocks are mixed between store views after upgrading to v.1.9.2.

If you want to use static blocks for the time being, you can make the changes listed in this post in the /app/code/local directory. The problem is that the new version is not setting proper cache keys for the static blocks, and since they are all the same they are rendering in place of one another. See details on the quick bugfix here. This is not an isolated problem, it's a Magento bug and is happening to lots of people.

 

Edit: I forgot to mention, that this adds cache keys for individual store, so that should be good, but you will need to also add the code in the post below it to determine if the view is HTTPS or HTTP in order to serve the proper URLS for images, etc, in your static blocks. I have included that change in the code blocks below for you - all changes are marked with a +.

 

In app/code/local/Mage/Cms/Block/Block.php at line 72:

 

         }
         return $html;
     }
+
+    /**
+     * Retrieve values of properties that unambiguously identify unique content
+     *
+     * @return array
+     */
+    public function getCacheKeyInfo()
+    {
+        $blockId = $this->getBlockId();
+        if ($blockId) {
+            $result = array(
+                $blockId,
+                Mage::app()->getStore()->getCode(),
+ (int)Mage::app()->getStore()->isCurrentlySecure(), + ); + } else { + $result = parent::getCacheKeyInfo(); + } + return $result; + } }

 

 

In app/code/local/Mage/Cms/Block/Widget/Block.php at line 82:

 

                 $helper = Mage::helper('cms');
                 $processor = $helper->getBlockTemplateProcessor();
                 $this->setText($processor->filter($block->getContent()));
+                $this->addModelTags($block);
             }
         }

         unset(self::$_widgetUsageMap[$blockHash]);
         return $this;
     }
+
+    /**
+     * Retrieve values of properties that unambiguously identify unique content
+     *
+     * @return array
+     */
+    public function getCacheKeyInfo()
+    {
+        $result = parent::getCacheKeyInfo();
+        $blockId = $this->getBlockId();
+        if ($blockId) {
+            $result[] = $blockId;
+        }
+        return $result;
+    }
 }

 

 

http://magento.stackexchange.com/a/69216

Dan Lewis
Lead Technician - Fix'D

Re: Static blocks are mixed between store views after upgrading to v.1.9.2.

Agree on acecameras conclusion.

I had also disable block HTML cache in order to make my site loading properly.

I have also run some speed tests and  the site is not slowing down probably because i am also using LiteMage Full Page cache.

 

So i hope that magento will give a solution soon

Re: Static blocks are mixed between store views after upgrading to v.1.9.2.

You can Disable the Blocks HTML output cache or using Rkt_SbCache Extension to fix this. Hope that magento will give a solution soon.

Re: Static blocks are mixed between store views after upgrading to v.1.9.2.

i have apply and test the quick solution posted

http://community.magento.com/t5/Technical-Issues/CMS-Caching-Issues-With-Magento-CE-1-9-2-0/m-p/1087... 

and the problem is solved