Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cache = Mage::app()->getCache();
- if(!$cache->load('itserv_feed_collection')) {
- $collection = Mage::getModel('catalog/product')->getCollection()
- ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
- ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
- ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
- ->addMinimalPrice()
- ->addTaxPercents()
- ->addStoreFilter()
- ->addAttributeToSort('entity_id', 'desc');
- // CategoryFilter
- $collection = $this->categoryFilter($collection);
- // getNumProduct
- $collection->setPageSize($this->getWidgetCfg('limit'));
- $cache->save(serialize($collection), "itserv_feed_collection", array("itserv_feed_collection"), 120);
- return $collection;
- }else {
- $collection = unserialize($cache->load('itserv_feed_collection'));
- return $collection;
- }
- // return $collection;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement