Public Member Functions | |
__construct () | |
Protected Member Functions | |
_toHtml () |
Definition at line 34 of file Detailed.php.
__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 }
_toHtml | ( | ) | [protected] |
Render block HTML
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 }