1
A
답변
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;
}
}
을 덮어