0

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 :)

  • 2
    put parent construct above in your constructor instead of put it as last one and then try again – Rajeev K Tomy Sep 19 '14 at 18:07
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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