ques-n9656fCK

Search A2Z 24

Question : Show simple products reviews on configurable product detail page

I want to show reviews of simple products on configurable product's detail page(PDP).

asked July 25, 2016

1 Answers

Dispalying 1 to 1 of 1 |

The code below will display the ratings and reviews for both configurable and simple products. Note, you should also modify the summary at the top of the product page that shows review count & overall average rating.

Copy /app/code/core/Mage/Review/Block/Product/View.php from core to local, and modify it. Line no approx. 75 was:

$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();

Change it to be:

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();
}
See comments (0) | Comment
Answered 8 Months ago
Dispalying 1 to 1 of 1 |

Write your Answer write code <pre class="brush: xml">---code---</pre>

Login as a member to access answering block !! click-here
loading...

Reveal Modal Goodness

This is a default modal in all its glory, but any of the styles here can easily be changed in the CSS.

This is just a simple modal with the default styles, but any type of content can live in here. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi quis sem vel enim eleifend tristique. Etiam tincidunt faucibus pharetra.

×