Month: October 2016

Caching Magento Blocks

class My_Custom_Block extends Mage_Catalog_Block_Product_View_Abstract { protected function _construct() { // the $groupId make it so each customer group will be cached separately $groupId = Mage::getSingleton(‘customer/session’)->getCustomerGroupId(); $this->addData(array( ‘cache_lifetime’ => 5600, ‘cache_tags’ => array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG), // you can add anything to the cache_key to make it cache separate versions for different customers and stores ‘cache_key’ => “custom_unique_name_{$groupId}” […]