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_Review
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: * Product Reviews Page
29: *
30: * @category Mage
31: * @package Mage_Review
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Review_Block_Product_View extends Mage_Catalog_Block_Product_View
35: {
36: protected $_reviewsCollection;
37:
38: /**
39: * Render block HTML
40: *
41: * @return string
42: */
43: protected function _toHtml()
44: {
45: $this->getProduct()->setShortDescription(null);
46:
47: return parent::_toHtml();
48: }
49:
50: /**
51: * Replace review summary html with more detailed review summary
52: * Reviews collection count will be jerked here
53: *
54: * @param Mage_Catalog_Model_Product $product
55: * @param string $templateType
56: * @param bool $displayIfNoReviews
57: * @return string
58: */
59: public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false, $displayIfNoReviews = false)
60: {
61: return
62: $this->getLayout()->createBlock('rating/entity_detailed')
63: ->setEntityId($this->getProduct()->getId())
64: ->toHtml()
65: .
66: $this->getLayout()->getBlock('product_review_list.count')
67: ->assign('count', $this->getReviewsCollection()->getSize())
68: ->toHtml()
69: ;
70: }
71:
72: public function getReviewsCollection()
73: {
74: if (null === $this->_reviewsCollection) {
75: $this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
76: ->addStoreFilter(Mage::app()->getStore()->getId())
77: ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
78: ->addEntityFilter('product', $this->getProduct()->getId())
79: ->setDateOrder();
80: }
81: return $this->_reviewsCollection;
82: }
83:
84: /**
85: * Force product view page behave like without options
86: *
87: * @return false
88: */
89: public function hasOptions()
90: {
91: return false;
92: }
93: }
94: