0

I facing issue described Here

I added the code to app/code/core/Mage/Cms/Block/Block.php at line 72:

and into

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

But someone also stated that:

(int)Mage::app()->getStore()->isCurrentlySecure()

Needs to be added in order to solve the issue completely, I just can't figure out in which file and where it needs to be added.

Could someone please help me out?

Thanks in advance.

2 Answers 2

1

This is what my free extension does. That is it will cache magento static block by considering store, cms tag, block identifier, secure or not. Please have a look or you can install it.

For more info, please have look at here

0
0

Looking at the original issue you need to add the isCurrentlySecure() call within the $result array of both changes.

app/code/core/Mage/Cms/Block/Block.php

             }
         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;
+    }
 }

app/code/core/Mage/Cms/Block/Widget/Block.php

$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;
+            $result[] = (int)Mage::app()->getStore()->isCurrentlySecure();
+        }
+        return $result;
+    }
 }
3
  • Don't you think that in app/code/core/Mage/Cms/Block/Block.php it should be: (int)Mage::app()->getStore()->isCurrentlySecure(), (with comma)?
    – user20620
    Jul 9, 2015 at 13:23
  • @user20620 it's the last item in the array so it shouldn't require a comma
    – Dave
    Jul 9, 2015 at 13:25
  • Thank you I am going to try and hope it won't give any error.
    – user20620
    Jul 9, 2015 at 13:26

Your Answer

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

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