I want to create product review and rating programmatically. I was able to create review programmatically by the following code snippet
<?php
ini_set('memory_limit', '128M');
require_once 'app/Mage.php';
Mage::app();
Mage::app()->setCurrentStore(1); //desired store id
$review = Mage::getModel('review/review');
$review->setEntityPkValue(1);//product id
$review->setStatusId(1);
$review->setTitle("mytitle");
$review->setDetail("mydetail");
$review->setEntityId(1);
$review->setStoreId(Mage::app()->getStore()->getId()); //storeview
$review->setStatusId(1); //approved
$review->setCustomerId(1);
$review->setNickname("Menickname");
$review->setReviewId($review->getId());
$review->setStores(array(Mage::app()->getStore()->getId()));
$review->save();
$review->aggregate();
?>
But I don't know how to create rating programmatically. I'm totally blank about it. Can anyone help on this?
$optionIdis a valid value for the rating. For example if in the default database rating id 3, which is price has the options 11, 12, 13, 14 and 15 so the option vote value need to be one of these. – David Manners Jun 26 '14 at 07:54