Magento : How to get Product Reviews posted during a time period

Customer reviews for your products and services always play a vital role in the success of your business. As magento have inbuilt functionality of reviews for products and when a customer write a review for product then the approved reviews will show on the product pages. If you are using service of Google Merchant Review Feeds then you need to submit the reviews posted between a specific dates. The following code snippet will be useful for you to get the magento product reviews.

How Magento Reviews are useful for growth of your business

<?php		// Added by Vaseem to get the product reviews posted during a time period
$fromDate	=	'2014-04-01 00:00:00';
$toDate		=	'2014-04-01 23:59:59';
$_reviews 	= 	Mage::getModel('review/review')
                ->getCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                ->addFieldToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate))
                ->setDateOrder()
                ->load();
foreach($_reviews as $review){
    $product 			= 	Mage::getModel('catalog/product')->load($review->getData('entity_pk_value'));
    $review_id			=	$review->getData('review_id');
    $created_at			=	$review->getData('created_at');
    $entity_id			=	$review->getData('entity_id');
    $entity_pk_value	=	$review->getData('entity_pk_value');
    $status_id			=	$review->getData('status_id');
    $detail_id			=	$review->getData('detail_id');
    $title				=	$review->getData('title');
    $detail				=	$review->getData('detail');
    $nickname			=	$review->getData('nickname');
    $customer_id		=	$review->getData('customer_id');
}
?>

I hope the above code will be useful for you šŸ™‚

By Vaseem Ansari

Iā€™m Vaseem, a Software Engineer by Profession, a Traveler, a Foodie by Heart and the founder of VaseemAnsari.com. I started traveling from college days and it has become a part of me now. So when ever I happen to get a chance I pack my bag and am on the roads. You can follow me on these social networks Facebook, Twitter, Google+ and Linkedin.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *