Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. $cache = Mage::app()->getCache();
  2. if(!$cache->load('itserv_feed_collection')) {
  3. $collection = Mage::getModel('catalog/product')->getCollection()
  4. ->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
  5. ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
  6. ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
  7. ->addMinimalPrice()
  8. ->addTaxPercents()
  9. ->addStoreFilter()
  10. ->addAttributeToSort('entity_id', 'desc');
  11.  
  12. // CategoryFilter
  13. $collection = $this->categoryFilter($collection);
  14.  
  15. // getNumProduct
  16. $collection->setPageSize($this->getWidgetCfg('limit'));
  17.  
  18. $cache->save(serialize($collection), "itserv_feed_collection", array("itserv_feed_collection"), 120);
  19.  
  20.  
  21.  
  22. return $collection;
  23. }else {
  24. $collection = unserialize($cache->load('itserv_feed_collection'));
  25. return $collection;
  26. }
  27. // return $collection;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement