2016-11-01 7 views

答えて

0

私は答えは、このクラス "Mage_Review_Block_Product_View"

class Example_Block_Product_View extends Mage_Review_Block_Product_View { 
    public function getReviewsCollection() { 
    $category_id = Mage::registry ('current_category')->getId(); 
    $category = Mage::getModel ('catalog/category')->load ($category_id); 
     $productCollection = Mage::getModel ('catalog/product') 
          ->getCollection() 
          ->addAttributeToSelect ('*') 
          ->addCategoryFilter ($category) 
          ->load(); 
     foreach ($productCollection as $product) { 
      $product_ids [] = $product->getId(); 
     } 
     if (null === $this->_reviewsCollection) { 
    $this->_reviewsCollection = Mage::getModel ('review/review') 
       ->getCollection() 
     ->addStoreFilter (Mage::app()->getStore()->getId()) 
     ->addStatusFilter (Mage_Review_Model_Review::STATUS_APPROVED) 
     ->addFieldToFilter ('entity_id', Mage_Review_Model_Review::ENTITY_PRODUCT) 
             ->addFieldToFilter ('entity_pk_value', array (
               'in' => $product_ids 
             ))->setDateOrder(); 
     } 

     return $this->_reviewsCollection; 
    } 
} 
を上書きしました
関連する問題