I am trying to import some reviews programatically. I am using the following code:

$review = Mage::getModel('review/review');

$date is a timestamp of the date of the review. The problem is that my reviews are being imported at the current date. How can I set the created_at parameter?

1 Answer 1


The problem is that the _beforeSave on the Mage_Review_Model_Resource_Review sets the created_at value when there is no id for the review, so for new reviews.

protected function _beforeSave(Mage_Core_Model_Abstract $object)
    if (!$object->getId()) {
    if ($object->hasData('stores') && is_array($object->getStores())) {
        $stores = $object->getStores();
        $stores[] = 0;
    } elseif ($object->hasData('stores')) {
        $object->setStores(array($object->getStores(), 0));
    return $this;

You could do one of the following:

  1. Rewrite the resource and change the function,
  2. Save first and then save again
  3. There may be another option that I cannot think of at the moment :(
  • Thanks for the heads up, I am doing a one time import and so can just go into the core comment out that line and uncomment it when I am done. May 21, 2014 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.