0
A
回答
0
首先屬於配置的產品,這種說法的產品都得到ID的:
$children_ids = Mage::getModel ('catalog/product_type_configurable')->getChildrenIds ($_product->getId());
通過各種簡單的產品,然後遍歷,並得到他們的評論,這樣的:
foreach ($children_ids as $child_id)
{
foreach ($child_id as $id)
{
$_items2 = Mage::getModel('review/review')->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->addEntityFilter('product', $id)
->addRateVotes()
->setDateOrder();
$_items = $_items2->getItems();
}}
查看「view/list.phtml」瞭解如何使用$ _items。
2
下面的代碼將顯示可配置產品和簡單產品的評分和評論。請注意,您還應修改產品頁面頂部的摘要,以顯示審覈計數&的總體平均評分。
從核心複製/app/code/core/Mage/Review/Block/Product/View.php到本地,並對其進行修改。 線75是:
$this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->addEntityFilter('product', $this->getProduct()->getId())
->setDateOrder();
將其更改爲:
if ($this->getProduct()->isConfigurable()){
//Get both configurable product and associated simple product reviews
$children_ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($this->getProduct()->getId());
$entity_ids = array($this->getProduct()->getId(), $children_ids);
$this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->addFieldToFilter('entity_pk_value', array('in' => $entity_ids))
->setDateOrder();
} else {
$this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->addEntityFilter('product', $this->getProduct()->getId())
->setDateOrder();
}
+0
有許多 「本地」 文件夾在Magento文件樹中。哪個應該放置View.php?我嘗試了app/code/local/View.php和app/code/local/Review/Block/Product/View.php,以及app/code/local/Mage/Review/Block/Product/View.php – Dwayne
相關問題
- 1. 如何在產品評論頁面顯示產品長描述?
- 2. 在可配置產品中顯示「缺貨」簡單產品?
- 3. 在Magento中顯示可配置產品的簡單產品清單
- 4. 希望在產品頁面的側邊欄中顯示產品評論magento
- 5. Magento產品評論submition返回頁面
- 6. 如何在magento類別中顯示可配置產品的簡單產品?
- 7. Magento - 相關產品不顯示在可配置產品下
- 8. Magento:在產品頁面上顯示兩個產品
- 9. 來自magento簡單產品的前端可配置產品?
- 10. Magento - 商品評論沒有顯示在商品評論頁面
- 11. 在產品頁面上顯示recent_viewed產品頁面
- 12. magento產品評論驗證
- 13. 簡單的產品圖像在配置產品 - Magento 1.5
- 14. Magento - 在可配置產品的產品頁面上調整「更多視圖」
- 15. Magento API:將先前存在的簡單產品分配給可配置產品
- 16. 在magento的可配置產品上顯示相關產品的圖像
- 17. Magento:在可配置產品上顯示相關產品的圖像
- 18. 簡單產品比可配置產品有什麼優勢
- 19. Magento產品頁面
- 20. Magento的相關產品沒有顯示產品頁面
- 21. Magento - 從產品登錄頁面顯示所有產品類別
- 22. 單個產品頁面上的產品圖片未顯示
- 23. Magento:無需設置每個簡單產品的可配置產品?
- 24. 即使配置產品被禁用,Magento也能從簡單產品獲得可配置產品
- 25. Magento類別頁面不顯示產品
- 26. 產品評論顯示使用光油,APC和塊緩存進行頁面緩存的產品頁面信息
- 27. 在Magento創建產品評論
- 28. Magento:購物車頁面上可配置產品的可用性
- 29. 如何在產品查看頁面上顯示3種相關產品,Magento?
- 30. 如何在Magento的產品列表頁面上顯示相關產品
http://ecommerce.aheadworks.com/magento-extensions/advanced-reviews.html – alfasin