dpndp64206 2013-12-05 14:04
浏览 17
已采纳

审核表格未提交

In my project, I added a new field location in "product reviews" of admin panel going through the following steps as explained in many blogs.

  • Created a new field in database table review_detail as location.
  • Added the following code in app/code/code/Mage/Adminhtml/Block/Review/Edit/Form.php

        $fieldset->addField('location', 'text', array(
                'name'  => 'location',
                'label' => Mage::helper('adminhtml')->__('Location'),
                'required' => false
            )
        ); 
    

Just above:

    $fieldset->addField('nickname', 'text', array(
        'label'     => Mage::helper('review')->__('Nickname'),
        'required'  => true,
        'name'      => 'nickname'
    ));
  • .Added the following code in app/code/core/Mage/Review/Model/Resource/Review.php

    $detail = array(
        'title'     => $object->getTitle(),
        'detail'    => $object->getDetail(),
        'nickname'  => $object->getNickname(),
        'location'  => $object->getLocation()   /* added */
    );
    
  • Added "location" in below function array. In the file: app/code/core/Mage/Review/Model/Resource/Review/Collection.php

    protected function _initSelect()
    {
        parent::_initSelect();
        $this->getSelect()
            ->join(array('detail' => $this->_reviewDetailTable),
                'main_table.review_id = detail.review_id',
                array('detail_id', 'title', 'detail', 'nickname', 'customer_id','location'));
        return $this;
    }
    
  • Added the following in {$mytheme}/template/review/form.phtml:

    <li>
          <label for="location_field" class="required"><em>*</em><?php echo $this->__('Location') ?></label>
          <div class="input-box">
               <input type="text" name="nickname" id="location_field" class="input-text required-entry" value="<?php echo $this->htmlEscape($data->getLocation()) ?>" />
          </div>
    </li>   
    

My problem is that though I can see a new field in admin panel, whenever I submit a review form it is not being submitted/stored in database.

I even re-indexed and cleared the cache.

What should I change more to make it work properly?

Please help... I am on magento 1.8.

PS: I know core files should not be changed. I will override this to new module once I have success in this issue.

  • 写回答

3条回答 默认 最新

  • douyao1994 2013-12-08 08:31
    关注

    I did follow exact steps explained in quetion. And find it working properly.

    Only issue I faced was that in {$mytheme}/template/review/form.phtml

    You have defined name="nickname" for location field instead of name="location"

    Correct this and if you still face same issue than then check if Module Classes as being overridden.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大