Mage_Rating_Block_Entity_Detailed Class Reference

Inheritance diagram for Mage_Rating_Block_Entity_Detailed:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()

Protected Member Functions

 _toHtml ()


Detailed Description

Definition at line 34 of file Detailed.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 36 of file Detailed.php.

00037     {
00038         parent::__construct();
00039         $this->setTemplate('rating/detailed.phtml');
00040     }


Member Function Documentation

_toHtml (  )  [protected]

Render block HTML

Returns:
string

Reimplemented from Mage_Core_Block_Template.

Definition at line 42 of file Detailed.php.

00043     {
00044         $entityId = Mage::app()->getRequest()->getParam('id');
00045         if( intval($entityId) <= 0 ) {
00046             return '';
00047         }
00048 
00049         $reviewsCount = Mage::getModel('review/review')
00050             ->getTotalReviews($entityId, true);
00051         if( $reviewsCount == 0 ) {
00052             #return Mage::helper('rating')->__('Be the first to review this product');
00053             $this->setTemplate('rating/empty.phtml');
00054             return parent::_toHtml();
00055         }
00056 
00057         $ratingCollection = Mage::getModel('rating/rating')
00058             ->getResourceCollection()
00059             ->addEntityFilter('product') # TOFIX
00060             ->setPositionOrder()
00061             ->setStoreFilter(Mage::app()->getStore()->getId())
00062             ->addRatingPerStoreName(Mage::app()->getStore()->getId())
00063             ->load();
00064 
00065         if ($entityId) {
00066             $ratingCollection->addEntitySummaryToItem($entityId, Mage::app()->getStore()->getId());
00067         }
00068 
00069         $this->assign('collection', $ratingCollection);
00070         return parent::_toHtml();
00071     }


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

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