Mage_Reports_Block_Product_Compared Class Reference

Inheritance diagram for Mage_Reports_Block_Product_Compared:

Mage_Reports_Block_Product_Abstract Mage_Catalog_Block_Product_Abstract Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Attributes

const XML_PATH_RECENTLY_COMPARED_COUNT = 'catalog/recently_products/compared_count'

Protected Member Functions

 getPageSize ()
 _getProductsToSkip ()
 _hasComparedProductsBefore ()
 _toHtml ()

Protected Attributes

 $_eventTypeId = Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE


Detailed Description

Definition at line 35 of file Compared.php.


Member Function Documentation

_getProductsToSkip (  )  [protected]

Retrieve Product Ids to skip

Returns:
array

Reimplemented from Mage_Reports_Block_Product_Abstract.

Definition at line 59 of file Compared.php.

00060     {
00061         $ids = array();
00062         if (Mage::helper('catalog/product_compare')->getItemCount()) {
00063             foreach (Mage::helper('catalog/product_compare')->getItemCollection() as $_item) {
00064                 $ids[] = $_item->getId();
00065             }
00066             if (($product = Mage::registry('product')) && $product->getId()) {
00067                 $ids[] = $product->getId();
00068             }
00069         }
00070         return $ids;
00071     }

_hasComparedProductsBefore (  )  [protected]

Check session has compared products

Returns:
bool

Definition at line 78 of file Compared.php.

00079     {
00080         return Mage::getSingleton('reports/session')->getData('compared_products');
00081     }

_toHtml (  )  [protected]

Prepare to html check has compared products

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 89 of file Compared.php.

00090     {
00091         if (!$this->_hasComparedProductsBefore()) {
00092             return '';
00093         }
00094 
00095         $collection = $this->_getRecentProductsCollection();
00096         $hasProducts = (bool)count($collection);
00097         if (is_null($this->_hasComparedProductsBefore())) {
00098             Mage::getSingleton('reports/session')->setData('compared_products', $hasProducts);
00099         }
00100         if ($hasProducts) {
00101             $this->setRecentlyComparedProducts($collection);
00102         }
00103 
00104         return parent::_toHtml();
00105     }

getPageSize (  )  [protected]

Retrieve page size (count)

Returns:
int

Reimplemented from Mage_Reports_Block_Product_Abstract.

Definition at line 46 of file Compared.php.

00047     {
00048         if ($this->hasData('page_size')) {
00049             return $this->getData('page_size');
00050         }
00051         return Mage::getStoreConfig(self::XML_PATH_RECENTLY_COMPARED_COUNT);
00052     }


Member Data Documentation

Reimplemented from Mage_Reports_Block_Product_Abstract.

Definition at line 39 of file Compared.php.

const XML_PATH_RECENTLY_COMPARED_COUNT = 'catalog/recently_products/compared_count'

Definition at line 37 of file Compared.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