When I disabled block_html cache tag then my code works fine.
I want to know how I can disable block_html programmatically in Magento for footer.phtml file?
When I disabled block_html cache tag then my code works fine.
I want to know how I can disable block_html programmatically in Magento for footer.phtml file?
There is method inside Mage_Core_Block_Abstract
/**
* Load block html from cache storage
*
* @return string | false
*/
protected function _loadCache()
{
if (is_null($this->getCacheLifetime()) || !$this->_getApp()->useCache(self::CACHE_GROUP)) {
return false;
}
As you can see the block will not be loaded from cache if its lifetime is null
Then open Footer Block file:
class Mage_Page_Block_Html_Footer extends Mage_Core_Block_Template
{
protected $_copyright;
protected function _construct()
{
$this->addData(array('cache_lifetime' => false));
$this->addCacheTag(array(
Mage_Core_Model_Store::CACHE_TAG,
Mage_Cms_Model_Block::CACHE_TAG
));
}
And all you need is put value 'null' instead of 'false'
$this->addData(array('cache_lifetime' => null));
Don't forget that magento strongly recommend do not edit core files.