A question for an expert. Make sure you read the preamble - the question is at the bottom.

In app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php I noticed a functionality to cache _getItemsData output:

122         $key = $this->getLayer()->getStateKey().'_'.$this->_requestVar;
123         $data = $this->getLayer()->getAggregator()->getCacheData($key);

but it turns out $this->getLayer()->getAggregator() which is Mage_CatalogIndex_Model_Aggregation is turned off:

45 class Mage_CatalogIndex_Model_Aggregation extends Mage_Core_Model_Abstract
46 {        
47     const CACHE_FLAG_NAME   = 'layered_navigation';
49     /**  
50      * Initialize resource model
51      */  
52     protected function _construct()
53     {    
54         $this->_init('catalogindex/aggregation');
55     }    
57     protected function _isEnabled()
58     {    
59         return Mage::app()->useCache(self::CACHE_FLAG_NAME); 
           #returns FALSE as there is no layered_navigation cache type                                                                                                                  
60     }    

What is more interesting is that if I try to set return true; in _isEnabled function Magento complains that no catalogindex_aggregation DB table is found.

Of course it is not found because Magento team turned it off by placing this file app/code/core/Mage/CatalogIndex/sql/catalogindex_setup/install- that does nothing:

 $installer = $this;
 /* @var $installer Mage_Core_Model_Resource_Setup */



That means a fresh Magento install doesn't have all catalogindex_* tables which means Mage_CatalogIndex_Model_Aggregation won't cache attribute filter data.

Mage_CatalogIndex was supposed to cache layered_navigation data.

Why was it turned off by Magento team?

I also see that Mage_Catalog_Block_Layer_View is not cacheable. I wonder why Magento doesn't cache layered navigation at all. No wonder Magento has a reputation for being slow.

An insight from an expert would be appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.