Question

I have block definition in cms page

{{block type="divante_cdp/homeblog"}}

And construct method of my block

public function __construct(array $args = array())
{
    $this->setTemplate('page/html/homeblog.phtml');
    $this->addData(array(
            'cache_lifetime' => 3600,
            'cache_tags'     => array(Mage_Cms_Model_Block::CACHE_TAG,'tag_home_homeblog'),
        ));

    parent::__construct($args);
}

Block isn't cached. After run below command there is no tag tag_home_homeblog

n98-magerun.phar cache:report -t

What i'm doing wrong? Cache is enabled :)

Was it helpful?

Solution

you need to put your __construct() like this.

public function __construct(array $args = array())
{
    parent::__construct($args);

    $this->setTemplate('page/html/homeblog.phtml');
    $this->addData(array(
            'cache_lifetime' => 3600,
            'cache_tags'     => array(Mage_Cms_Model_Block::CACHE_TAG,'tag_home_homeblog'),
        ));

}

Now parent __construct() will not alter the changes that your made in your custom block's __construct() . Thus it makes your __construct() alterations in effect.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top