cancel
Showing results for 
Search instead for 
Did you mean: 

How to Bulk import Product Reviews in Magento 1.9?

Re: How to Bulk import Product Reviews in Magento 1.9?

HI @Aveeva 

You need to customise review/rating code in your existing review code.

You can call a new function as addRating($reviewId) and can call in the function after 

$review->aggregate();

line. In this function you can add rating based on Review Id. 

I hope it will help you. 

Re: How to Bulk import Product Reviews in Magento 1.9?

  1. <?php
  2. require_once 'app/Mage.php'; // Load Mage
  3. Mage::app(); // Init Mage
  4. ini_set('memory_limit', '128M');
  5. $fp = fopen('Reviews.csv', 'r');
  6. Mage::app()->setCurrentStore(1); //desired store id
  7. while($line = fgetcsv($fp)) {
  8. // $review = Mage::getModel('review/review');
  9. $review = Mage::getModel('review/rating');
  10. $review->setEntityPkValue($line[0]);//product id //a
  11. $review->setStatusId($line[1]); //b
  12. $review->setTitle($line[2]); //c
  13. $review->setDetail($line[3]); //d
  14. $review->setEntityId($line[4]); //e
  15. $review->setStoreId(Mage::app()->getStore()->getId());
  16. $review->setStatusId($line[5]); //approved //f
  17. $review->setCustomerId($line[6]);//null is for administrator //g
  18. $review->setNickname($line[7]); //h
  19. $review->setReviewId($review->getId());
  20. $review->setStores(array(Mage::app()->getStore()->getId()));
  21. $review->save();
  22. $review->aggregate();
  23. $review->addRating($reviewId);
  24. }
  25. ?>

Pls check the line 9 & 23, is my code right, if wong how can i do correct and how to import ratings values using csv.

Re: How to Bulk import Product Reviews in Magento 1.9?

@Vimal Kumar  Could you pls help me with how can i add Date and how to change date already imported reviews?