00001 <?php 00002 /** 00003 * Magento 00004 * 00005 * NOTICE OF LICENSE 00006 * 00007 * This source file is subject to the Open Software License (OSL 3.0) 00008 * that is bundled with this package in the file LICENSE.txt. 00009 * It is also available through the world-wide-web at this URL: 00010 * http://opensource.org/licenses/osl-3.0.php 00011 * If you did not receive a copy of the license and are unable to 00012 * obtain it through the world-wide-web, please send an email 00013 * to license@magentocommerce.com so we can send you a copy immediately. 00014 * 00015 * DISCLAIMER 00016 * 00017 * Do not edit or add to this file if you wish to upgrade Magento to newer 00018 * versions in the future. If you wish to customize Magento for your 00019 * needs please refer to http://www.magentocommerce.com for more information. 00020 * 00021 * @category Mage 00022 * @package Mage_Review 00023 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) 00024 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 00025 */ 00026 00027 /** 00028 * Product Reviews Page 00029 * 00030 * @category Mage 00031 * @package Mage_Review 00032 * @author Magento Core Team <core@magentocommerce.com> 00033 */ 00034 class Mage_Review_Block_Product_View extends Mage_Catalog_Block_Product_View 00035 { 00036 protected $_reviewsCollection; 00037 00038 protected function _toHtml() 00039 { 00040 $this->getProduct()->setShortDescription(null); 00041 00042 return parent::_toHtml(); 00043 } 00044 00045 /** 00046 * Replace review summary html with more detailed review summary 00047 * Reviews collection count will be jerked here 00048 * 00049 * @param Mage_Catalog_Model_Product $product 00050 * @param string $templateType 00051 * @param bool $displayIfNoReviews 00052 * @return string 00053 */ 00054 public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false, $displayIfNoReviews = false) 00055 { 00056 return 00057 $this->getLayout()->createBlock('rating/entity_detailed') 00058 ->setEntityId($this->getProduct()->getId()) 00059 ->toHtml() 00060 . 00061 $this->getLayout()->getBlock('product_review_list.count') 00062 ->assign('count', $this->getReviewsCollection()->getSize()) 00063 ->toHtml() 00064 ; 00065 } 00066 00067 public function getReviewsCollection() 00068 { 00069 if (null === $this->_reviewsCollection) { 00070 $this->_reviewsCollection = Mage::getModel('review/review')->getCollection() 00071 ->addStoreFilter(Mage::app()->getStore()->getId()) 00072 ->addStatusFilter('approved') 00073 ->addEntityFilter('product', $this->getProduct()->getId()) 00074 ->setDateOrder(); 00075 } 00076 return $this->_reviewsCollection; 00077 } 00078 00079 /** 00080 * Force product view page behave like without options 00081 * 00082 * @return false 00083 */ 00084 public function hasOptions() 00085 { 00086 return false; 00087 } 00088 }