Follow by Email

Monday, September 12, 2011

How to add extra field in review form in magento

I have added 3 extra field in review form
just go to the frontend\base\default\template\review/form.phtml
add three field as other text field.
now go to app\code\core\Mage\Review\Model\Mysql4\Review.php
protected function _afterSave(Mage_Core_Model_Abstract $object)

$detail = array(
'title' => $object->getTitle(),
'detail' => $object->getDetail(),
'nickname' => $object->getNickname(),
'email' => $object->getEmail(), //this field add by sourav
'fname' => $object->getFname(), //this field add by sourav
'lname' => $object->getLname(), //this field add by sourav
now add email,fname,lname in the review_detail table in the database
also go to app\code\core\Mage\Adminhtml\Block\Review\Edit\Form.php also add

$fieldset->addField('fname', 'text', array( //this field add by sourav
'label' => Mage::helper('review')->__('First Name'),
'required' => true,
'name' => 'fname'

$fieldset->addField('lname', 'text', array( //this field add by sourav
'label' => Mage::helper('review')->__('Last Name'),
'required' => true,
'name' => 'lname'

$fieldset->addField('email', 'text', array( //this field add by sourav
'label' => Mage::helper('review')->__('Email'),
'required' => true,
'name' => 'email'

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


  1. Hi there,

    Even I am looking forward to add an 'Email' field in Review form but just for Guest Customers. So that when they post a review, they can be tracked through their email. I was hoping to do this using a custom module. Do you have any idea on how to it using a custom module so that future upgrades don't over write the changes? Please please help me give some pointers as I am stuck with this for quite some time.

  2. Useful stuff, thanks.

    Just to let you know, I had to add the new fields to app/code/core/Mage/Review/Model/Resource/Review/Collection.php in order to use the "set" and "get" functions. Hope someone find this info of some use.

  3. hi nice post,

    i have a problem on how to call the value of the custom field that has been store in to db..

  4. You may want the email field to appear within the initial grid list as well for pending reviews. If so, override Mage/Adminhtml/Block/Review/Grid.php.

    Within the file you will notice the various column details. Simply duplicate one and rename it with your new fields values. After you edit approximately 6 files, and add an entry to the database- bam you added a few fields to a form.

    I can use Magento, but I hate it- though hopefully that helps someone. Also- be sure not to overwrite core. Drop any file structure your overriding into core local with the same structure.

  5. I added a new field to review form, and it worked,
    my problem is when I try to show it in review list