Magento - Overwrite core 'Review' module to add custom 'Email' field

Magento - Overwrite core 'Review' module to add custom 'Email' field

August 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Overwrite core 'Review' module to add custom 'Email' field

Extending Magento Core Review Module: Adding a Custom ‘Email’ Field

Hello everyone,

Today I want to share some insights on how you can extend the core Review module in Magento to add a custom field like an ‘Email’. This is a common requirement when you want to expand your review system beyond what’s provided out-of-the-box by Magento. Let’s dive right into it.

Understanding the Problem

The problem at hand is that we want to modify the core Review module to include an additional field for the customer’s email address. However, modifying the core files directly is not a best practice as it may cause issues with future upgrades of Magento.

So instead, what we are going to do is create our own custom extension to the Review model and override the necessary methods to add our new field.

Step 1: Creating Our Custom Model

The first thing we need to do is create our own custom model that extends from the core Mage_Review_Model_Review model. Let’s call it CM_Reviewmail_Model_Review.

In this model, we are going to override a few key methods:

Step 2: Overriding the _afterSave Method

The _afterSave method is called right after a review object has been saved into the database. This is where we can save our custom fields separately.

Here’s what I did in my implementation of CM_Reviewmail_Model_Resource_Review:

protected function _afterSave(Mage_Core_Model_Abstract $object)
{
    // ... existing code here ...

    /**
     * save detail
     */
    $detail = array(
        'title' => $object->getTitle(),
        'detail' => $object->getDetail(),
        'nickname' => $object->getNickname(),
        'email' => $object->getEmail(), // <--- our new field
    );

    $select = $adapter->select()
        ->from($this->_reviewDetailTable, 'detail_id')
        ->where('review_id = :review_id');
    $detailId = $adapter->fetchOne($select, array(':reviewid' => $object->getId()));

    if ($detailId) {
        $condition = array("detail_id = ?" => $detailId);
        $adapter->update($this->_reviewDetailTable, $detail, $condition);
    } else {
        $detail['store_id'] = $object->getStoreId();
        $detail['customer_id'] = $object->getCustomerId();
        $detail['review_id'] = $object->getId();
        $adapter->insert($this->_reviewDetailTable, $detail);
    }

    // ... existing code here ...

    return $this;
}

As you can see, I added a new field to the $detail array that gets populated with the email value from our object.

Step 3: Updating Our Custom Form

Now we need to update our custom form (CM_Reviewmail_Model_Resources_Review.php) to include this new ‘Email’ field:

$fieldset->addField('email', 'text', array(
    'label' => Mage::helper('review')->__('Email'),
    'required' => true,
    'name' => 'email'
));

Step 4: Updating Our SQL Schema

Finally, we need to update the Review Detail table in our database schema to include this new email field. This is where that CM_Reviewmail_Model_Resource_Mysl4_Setup.php class comes into play.

In its constructor method, you would have something like:

public function __construct()
{
    $this->installEntities();
}

protected function installEntities()
{
    $installer = new Mage_Eav_Model_Installer('review_detail');
    $installer->installSchema($installer->getDefaultSchema());
}

And in the setup/install-1.0.0.4.sql file (or whatever your version is), you would update the review_detail table to include:

ALTER TABLE review_detail ADD COLUMN email VARCHAR(255) NULL;

Conclusion

So there you have it - a simple walkthrough on how to add an additional field to Magento’s Review system using a custom model extension.

Remember, in general with Magento, you always want to avoid modifying the core files directly if possible. This is good practice for maintainability and future upgrade compatibility.

I hope this helps out some of you looking for a solution! Let me know if you have any questions below.

Happy coding!

[Your Name] Laravel Company Logo [Backlink to https://laravelcompany.com]

Database Extensions Deployment Email

Our network