0

I want to add a custom field to the review form in Magento. I have tried this but the data is not saved, it shows the field.

app\code\core\Mage\Adminhtml\Block\Review\Edit\Form.php

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

After

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

app\design\frontend\theme\theme\template\review\form.phtml

        <li class="formlistreview">
            <label for="email_field" class="required"><em>*</em><?php echo $this->__('E-mail') ?></label>
            <div class="input-box">
                <input type="text" name="email" id="email_field" class="input-text required-entry" value="<?php echo $this->htmlEscape($data->getEmail()) ?>" />
            </div>
        </li>

app\code\core\Mage\Review\Model\Resource\Review.php

protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$detail = array(
'title' => $object->getTitle(),
'detail' => $object->getDetail(),
'nickname' => $object->getNickname(),
'email' => $object->getEmail(), // New field 1
);

What am I missing?

| improve this question | | | | |
3

use $this instead of $object

protected function _afterSave(Mage_Core_Model_Abstract $object)
{
$detail = array(
'title' => $this->getTitle(),
'detail' => $this->getDetail(),
'nickname' => $this->getNickname(),
'email' => $this->getEmail(), // New field 1
);
| improve this answer | | | | |
  • @TejabhagavanKollepara dear check the error log what error their check for exception and etc what i can do from only url? – Qaisar Satti Jan 12 '17 at 12:46
1

You need to do is add a column email in review_detail table. Then this issue would be resolved.

It's too old post, but it might help someone. So, i just figured out the solution.

| improve this answer | | | | |

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.