Mage_Reports_Block_Product_Abstract Class Reference

Inheritance diagram for Mage_Reports_Block_Product_Abstract:

Mage_Catalog_Block_Product_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Reports_Block_Product_Compared Mage_Reports_Block_Product_Viewed

List of all members.

Protected Member Functions

 getPageSize ()
 _getProductsToSkip ()
 _getRecentProductsCollection ()

Protected Attributes

 $_eventTypeId = 0


Detailed Description

Definition at line 27 of file Abstract.php.


Member Function Documentation

_getProductsToSkip (  )  [protected]

Obtain product ids, that must not be included in collection

Returns:
array

Reimplemented in Mage_Reports_Block_Product_Compared, and Mage_Reports_Block_Product_Viewed.

Definition at line 48 of file Abstract.php.

00049     {
00050         return array();
00051     }

_getRecentProductsCollection (  )  [protected]

Get products collection and apply recent events log to it

Returns:
Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection

Definition at line 58 of file Abstract.php.

00059     {
00060         // get products collection and apply status and visibility filter
00061         $collection = $this->_addProductAttributesAndPrices(Mage::getModel('catalog/product')->getCollection())
00062             ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
00063             ->addUrlRewrite()
00064             ->setPageSize($this->getPageSize())
00065             ->setCurPage(1)
00066         ;
00067         Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
00068         Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
00069 
00070         // apply events log to collection with required parameters
00071         $skip = $this->_getProductsToSkip();
00072         $subtype = 0;
00073         if (Mage::getSingleton('customer/session')->isLoggedIn()) {
00074             $subjectId = Mage::getSingleton('customer/session')->getCustomer()->getId();
00075         } else {
00076             $subjectId = Mage::getSingleton('log/visitor')->getId();
00077             $subtype = 1;
00078         }
00079         Mage::getResourceSingleton('reports/event')->applyLogToCollection($collection, $this->_eventTypeId, $subjectId, $subtype, $skip);
00080 
00081         foreach ($collection as $product) {
00082             $product->setDoNotUseCategoryId(true);
00083         }
00084         return $collection;
00085     }

getPageSize (  )  [protected]

Retrieve page size (count)

Returns:
int

Reimplemented in Mage_Reports_Block_Product_Compared, and Mage_Reports_Block_Product_Viewed.

Definition at line 36 of file Abstract.php.

00037     {
00038         if ($this->hasData('page_size')) {
00039             return $this->getData('page_size');
00040         }
00041         return 5;
00042     }


Member Data Documentation

$_eventTypeId = 0 [protected]

Reimplemented in Mage_Reports_Block_Product_Compared, and Mage_Reports_Block_Product_Viewed.

Definition at line 29 of file Abstract.php.


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

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