In this tutorial I will let you know how to add a custom field in review in Magento. Reviews are important to get collect feedback from customers. Now if you want to get their email address too with their review, this tutorial will help you add an email field in review form.
Add a input type field for email in template\review\form.phtml as below.
<li> Â Â Â <label for="email_field" class="required"><em>*</em><?php echo $this->__('Email') ?></label> Â Â Â <div class="input-box"> Â Â Â Â Â Â <input type="text" name="email" id="email_field" class="input-text required-entry" value="<?php echo $this->escapeHtml($data->getEmail()) ?>" /> Â Â Â </div> </li>
Add an ’email’ field in review_detail table to store email values in database with review.
ALTER TABLE `review_detail` ADD `email` VARCHAR( 150 ) NOT NULL AFTER `nickname`
Now create a copy of code\core\Mage\Review\Model\Resource\Review.php file in community folder with same folder structure as code\community\Mage\Review\Model\Resource\Review.php to update core file.
Find below code in Review.php file:
protected function _afterSave(Mage_Core_Model_Abstract $object) {    $adapter = $this->_getWriteAdapter();    /**    * save detail    */    $detail = array(       'title'    => $object->getTitle(),       'detail'   => $object->getDetail(),       'nickname' => $object->getNickname(),    );    .... }
Replace with below code:
protected function _afterSave(Mage_Core_Model_Abstract $object) {    $adapter = $this->_getWriteAdapter();    /**    * save detail    */    $detail = array(       'title'    => $object->getTitle(),       'detail'   => $object->getDetail(),       'nickname' => $object->getNickname(),       'email' => $object->getEmail(),    );    ... }
Hope this tutorial will help you to add custom field in review form in magento. So you can get email address with their reviews.