Skip to content

Commit

Permalink
Fixed some caching issues
Browse files Browse the repository at this point in the history
- don't cache prev block anymore if child isn't cacheable
  • Loading branch information
tobi-pb committed Sep 18, 2017
1 parent 46d0e81 commit 0f30fec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/code/community/Webguys/Easytemplate/Block/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function getCacheKeyInfo()
Mage::app()->getStore()->getCode(),
(int)Mage::app()->getStore()->isCurrentlySecure(),
Mage::getSingleton('customer/session')->isLoggedIn(),
Mage::getSingleton('customer/session')->getCustomerGroupId(),
$this->getGroup()->getId()
);
}
Expand Down Expand Up @@ -78,6 +79,10 @@ public function setChildsBasedOnGroup($group, $parent = null)
$childBlock->setTemplateCode($templateCode);
$childBlock->setGroup($group);

if(!$childBlock->getCacheLifetime()) {
$this->_cachingAllowed=false;
}

/** @var $field Webguys_Easytemplate_Model_Input_Parser_Field */
foreach ($model->getFields() as $field) {
$fieldCode = $field->getCode();
Expand Down
11 changes: 10 additions & 1 deletion app/code/community/Webguys/Easytemplate/Block/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ public function getChildHtml($name = '', $useCache = true, $sorted = false)
{
return $this->getRenderer()->toHtml();
}
}

public function getCacheLifetime()
{
if (!$this->hasData('cache_lifetime')) {
return 3600;
}
return $this->getData('cache_lifetime');
}

}

0 comments on commit 0f30fec

Please sign in to comment.