Mage_Catalog_Block_Product_New Class Reference

Inheritance diagram for Mage_Catalog_Block_Product_New:

Mage_Catalog_Block_Product_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 setProductsCount ($count)
 getProductsCount ()

Public Attributes

const DEFAULT_PRODUCTS_COUNT = 5

Protected Member Functions

 _beforeToHtml ()

Protected Attributes

 $_productsCount = null


Detailed Description

Definition at line 34 of file New.php.


Member Function Documentation

_beforeToHtml (  )  [protected]

Before rendering html, but after trying to load cache

Returns:
Mage_Core_Block_Abstract

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 (  ) 

Definition at line 70 of file New.php.

00071     {
00072         if (null === $this->_productsCount) {
00073             $this->_productsCount = self::DEFAULT_PRODUCTS_COUNT;
00074         }
00075         return $this->_productsCount;
00076     }

setProductsCount ( count  ) 

Definition at line 64 of file New.php.

00065     {
00066         $this->_productsCount = $count;
00067         return $this;
00068     }


Member Data Documentation

$_productsCount = null [protected]

Definition at line 36 of file New.php.

Definition at line 38 of file New.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:36 2009 for Magento by  doxygen 1.5.8