Skip to content

Instantly share code, notes, and snippets.

@piotrekkaminski
Created July 21, 2015 20:24
Show Gist options
  • Save piotrekkaminski/ecd245e8c9390e4020db to your computer and use it in GitHub Desktop.
Save piotrekkaminski/ecd245e8c9390e4020db to your computer and use it in GitHub Desktop.
cms block fix
diff --git a/app/code/core/Mage/Cms/Block/Block.php b/app/code/core/Mage/Cms/Block/Block.php
index bc81de3..a0dce44 100755
--- a/app/code/core/Mage/Cms/Block/Block.php
+++ b/app/code/core/Mage/Cms/Block/Block.php
@@ -72,4 +72,24 @@ protected function _toHtml()
}
return $html;
}
+
+ /**
+ * Retrieve values of properties that unambiguously identify unique content
+ *
+ * @return array
+ */
+ public function getCacheKeyInfo()
+ {
+ $blockId = $this->getBlockId();
+ if ($blockId) {
+ $result = array(
+ 'CMS_BLOCK',
+ $blockId,
+ Mage::app()->getStore()->getCode(),
+ );
+ } else {
+ $result = parent::getCacheKeyInfo();
+ }
+ return $result;
+ }
}
diff --git a/app/code/core/Mage/Cms/Block/Widget/Block.php b/app/code/core/Mage/Cms/Block/Widget/Block.php
index 2352be7..df1b332 100644
--- a/app/code/core/Mage/Cms/Block/Widget/Block.php
+++ b/app/code/core/Mage/Cms/Block/Widget/Block.php
@@ -82,10 +82,26 @@ protected function _beforeToHtml()
$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;
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment