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

asked Sep 19, 2014 at 18:05
1
  • 2
    put parent construct above in your constructor instead of put it as last one and then try again Commented Sep 19, 2014 at 18:07

1 Answer 1

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.

answered Sep 20, 2014 at 6:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.