Ive noticed that my home page takes a long time to load - more than 6 seconds infact according to site24x7.com, so I included elements to try to determine the cause, and this is up to 2 product collection files I made to show new products and best-selling products.
As soon as I remove them from the main page, the page loads in less than 0.5 seconds.
So, can anyone help with optimizing and caching productCollection? I have APC installed and running on the server, but I'm not sure that it caches files located in app / design / frontend / default / MY_THEME / catalog / product / newproducts.phtml
So my call to collect the best-selling (most-watched in fact) is as follows:
<?php $storeId = Mage::app()->getStore()->getId(); <?php $_productCollection= Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*') ->addStoreFilter($storeId) ->addViewsCount() ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->addFieldToFilter('status',Mage_Catalog_Model_Product_Status::STATUS_ENABLED); $_productCollection->getSelect()->limit(8) ?>
How can I optimize this?
source share