Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Rating_Block_Entity_Detailed
  • Mage_Rating_Helper_Data
  • Mage_Rating_Model_Mysql4_Rating
  • Mage_Rating_Model_Mysql4_Rating_Collection
  • Mage_Rating_Model_Mysql4_Rating_Entity
  • Mage_Rating_Model_Mysql4_Rating_Option
  • Mage_Rating_Model_Mysql4_Rating_Option_Collection
  • Mage_Rating_Model_Mysql4_Rating_Option_Vote
  • Mage_Rating_Model_Mysql4_Rating_Option_Vote_Collection
  • Mage_Rating_Model_Observer
  • Mage_Rating_Model_Rating
  • Mage_Rating_Model_Rating_Entity
  • Mage_Rating_Model_Rating_Option
  • Mage_Rating_Model_Rating_Option_Vote
  • Mage_Rating_Model_Resource_Rating
  • Mage_Rating_Model_Resource_Rating_Collection
  • Mage_Rating_Model_Resource_Rating_Entity
  • Mage_Rating_Model_Resource_Rating_Option
  • Mage_Rating_Model_Resource_Rating_Option_Collection
  • Mage_Rating_Model_Resource_Rating_Option_Vote
  • Mage_Rating_Model_Resource_Rating_Option_Vote_Collection
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Magento
 4:  *
 5:  * NOTICE OF LICENSE
 6:  *
 7:  * This source file is subject to the Open Software License (OSL 3.0)
 8:  * that is bundled with this package in the file LICENSE.txt.
 9:  * It is also available through the world-wide-web at this URL:
10:  * http://opensource.org/licenses/osl-3.0.php
11:  * If you did not receive a copy of the license and are unable to
12:  * obtain it through the world-wide-web, please send an email
13:  * to license@magentocommerce.com so we can send you a copy immediately.
14:  *
15:  * DISCLAIMER
16:  *
17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
18:  * versions in the future. If you wish to customize Magento for your
19:  * needs please refer to http://www.magentocommerce.com for more information.
20:  *
21:  * @category    Mage
22:  * @package     Mage_Rating
23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
25:  */
26: 
27: /**
28:  * Entity rating block
29:  *
30:  * @category   Mage
31:  * @package    Mage_Rating
32:  * @author      Magento Core Team <core@magentocommerce.com>
33:  */
34: class Mage_Rating_Block_Entity_Detailed extends Mage_Core_Block_Template
35: {
36:     public function __construct()
37:     {
38:         parent::__construct();
39:         $this->setTemplate('rating/detailed.phtml');
40:     }
41: 
42:     protected function _toHtml()
43:     {
44:         $entityId = Mage::app()->getRequest()->getParam('id');
45:         if (intval($entityId) <= 0) {
46:             return '';
47:         }
48: 
49:         $reviewsCount = Mage::getModel('review/review')
50:             ->getTotalReviews($entityId, true);
51:         if ($reviewsCount == 0) {
52:             #return Mage::helper('rating')->__('Be the first to review this product');
53:             $this->setTemplate('rating/empty.phtml');
54:             return parent::_toHtml();
55:         }
56: 
57:         $ratingCollection = Mage::getModel('rating/rating')
58:             ->getResourceCollection()
59:             ->addEntityFilter('product') # TOFIX
60:             ->setPositionOrder()
61:             ->setStoreFilter(Mage::app()->getStore()->getId())
62:             ->addRatingPerStoreName(Mage::app()->getStore()->getId())
63:             ->load();
64: 
65:         if ($entityId) {
66:             $ratingCollection->addEntitySummaryToItem($entityId, Mage::app()->getStore()->getId());
67:         }
68: 
69:         $this->assign('collection', $ratingCollection);
70:         return parent::_toHtml();
71:     }
72: }
73: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0