/** * Product view block, don't cache if rendered with cart item update * * @param Mage_Catalog_Block_Product_View $block */ public function applyProductView(Mage_Catalog_Block_Product_View $block) { // The "messages" block is session-dependent, don't cache if (Mage::helper('cache')->responseHasMessages()) { $block->setData('cache_lifetime', null); return; } // Cart stuff is session-dependent $request = $block->getRequest(); if ($request->getModuleName() == 'checkout' && $request->getControllerName() == 'cart' && $request->getActionName() == 'configure' && $request->getParam('id')) { $block->setData('cache_lifetime', null); return; } // Set cache tags $tags = array(Mage_Catalog_Model_Product::CACHE_TAG . '_' . $block->getProduct()->getId()); $block->setData('cache_tags', $tags); // Set cache keys $keys = $this->_getBasicKeys($block); $_taxCalculator = Mage::getModel('tax/calculation'); $_customer = Mage::getSingleton('customer/session')->getCustomer(); $_product = $block->getProduct(); $keys = array_merge($keys, array($_product->getId(), $_customer->getGroupId(), $_taxCalculator->getRate($_taxCalculator->getRateRequest()->setProductClassId($_product->getTaxClassId())))); $block->setData('cache_key', $this->_getCacheKey($keys, $block)); }