Magento Boogieman이 당신을 얻을 것이라는 것을 모두 알고 있기 때문에 우리는 올바른 방법으로 커스텀 모듈을 만들어야한다고 생각합니다! 코어를 변경하면 :)
다음 파일이 필요합니다. app/etc/modules/Bhupendra_Cms.xml
<?xml version="1.0"?>
<config>
<modules>
<Bhupendra_Cms>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Cms/>
</depends>
</Bhupendra_Cms>
</modules>
</config>
app/code/local/Bhupendra/Cms/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Bhupendra_Cms>
<version>1.0.0</version>
</Bhupendra_Cms>
</modules>
<global>
<blocks>
<cms>
<rewrite>
<block>Bhupendra_Cms_Block_Block</block>
<widget_block>Bhupendra_Cms_Block_Widget_Block</widget_block>
</rewrite>
</cms>
</blocks>
</global>
</config>
app/code/local/Bhupendra/Cms/Block/Block.php
<?php
class Bhupendra_Cms_Block_Block extends Mage_Cms_Block_Block {
public function getCacheKeyInfo()
{
$blockId = $this->getBlockId();
if ($blockId) {
$result = array(
$blockId,
Mage::app()->getStore()->getCode(),
);
} else {
$result = parent::getCacheKeyInfo();
}
return $result;
}
}
app/code/local/Bhupendra/Cms/Block/Widget/Block.php
class Bhupendra_Cms_Block_Widget_Block extends Mage_Cms_Block_Widget_Block
{
/**
* Storage for used widgets
*
* @var array
*/
static protected $_widgetUsageMap = array();
/**
* Prepare block text and determine whether block output enabled or not
* Prevent blocks recursion if needed
*
* @return Mage_Cms_Block_Widget_Block
*/
protected function _beforeToHtml()
{
parent::_beforeToHtml();
$blockId = $this->getData('block_id');
$blockHash = get_class($this) . $blockId;
if (isset(self::$_widgetUsageMap[$blockHash])) {
return $this;
}
self::$_widgetUsageMap[$blockHash] = true;
if ($blockId) {
$block = Mage::getModel('cms/block')
->setStoreId(Mage::app()->getStore()->getId())
->load($blockId);
if ($block->getIsActive()) {
/* @var $helper Mage_Cms_Helper_Data */
$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;
}
}
자세한 내용을 보려면 다음 블로그를 방문하십시오.
https://www.milople.com/blogs/ecommerce/solved-magento-static-block-display-issue.html