Engine23
blogBannerImage
By Engine23

How to get the reviews for a product by customer

Here is how you can get a product reviewed by a customer in Magento

$storeId = Mage::app()->getStore()->getId();
$customer_reviews = Mage::getModel('review/review')
->getResourceCollection()
->addStoreFilter($storeId)
->addEntityFilter('product', $product_id)
->addFieldToFilter('customer_id', array('eq' =>$customer->getData('id')));
 

If you wanted it to be a bit more specific to just approved magento reviews but also get the votes and date order:

$customer_reviews = Mage::getModel('review/review')
->getResourceCollection()
->addStoreFilter($storeId)
->addEntityFilter('product', $product_id)
->addFieldToFilter('customer_id', array('eq' =>$customer->getData('id')))
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->setDateOrder()
->addRateVotes();