Public Member Functions | |
setProductsCount ($count) | |
getProductsCount () | |
Public Attributes | |
const | DEFAULT_PRODUCTS_COUNT = 5 |
Protected Member Functions | |
_beforeToHtml () | |
Protected Attributes | |
$_productsCount = null |
Definition at line 34 of file New.php.
_beforeToHtml | ( | ) | [protected] |
Before rendering html, but after trying to load cache
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 40 of file New.php.
00041 { 00042 $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT); 00043 00044 $collection = Mage::getResourceModel('catalog/product_collection'); 00045 Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); 00046 Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection); 00047 00048 $collection = $this->_addProductAttributesAndPrices($collection) 00049 ->addStoreFilter() 00050 ->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate)) 00051 ->addAttributeToFilter('news_to_date', array('or'=> array( 00052 0 => array('date' => true, 'from' => $todayDate), 00053 1 => array('is' => new Zend_Db_Expr('null'))) 00054 ), 'left') 00055 ->addAttributeToSort('news_from_date', 'desc') 00056 ->setPageSize($this->getProductsCount()) 00057 ->setCurPage(1) 00058 ; 00059 $this->setProductCollection($collection); 00060 00061 return parent::_beforeToHtml(); 00062 }
getProductsCount | ( | ) |
setProductsCount | ( | $ | count | ) |
const DEFAULT_PRODUCTS_COUNT = 5 |