1.      数据库中review_detail表新增字段 reply


2.      修改Form.php文件,添加回复文本框,  app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php  96行

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

135行

$fieldset->addField('reply', 'textarea', array(
            'label'     => Mage::helper('review')->__('Reply'),
            'required'  => false,
            'name'      => 'reply',
            'style'     => 'height:24em;',
        ));

3.      修改Review.php文件,添加表单获取字段,  app/code/core/Mage/Review/Model/Mysql4/ Review.php 95行

/**
         * save detale
         */
		if(!is_null($object->getReply())){
			$reply=$object->getReply();
		}else{
			$reply='';
		}
        $detail = array(
            'title'     => $object->getTitle(),
            'detail'    => $object->getDetail(),
            'nickname'  => $object->getNickname(),
            'reply'     => $object->getReply(),
        );

4.修改list.phtml文件,增加回复输出,app/design/frontend/default/eshopstandard/template/review/product/view/list.phtml   56行

<?php echo nl2br($this->htmlEscape($_review->getDetail())) ?>
                <small class="date"><?php echo $this->__('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?></small>
		<p style="color: rgb(204, 0, 51);"><?php echo $this->__('Reply:') ?><?php echo nl2br($this->htmlEscape($_review->getReply())) ?></p>

1.5和1.6的问题:需要添加这个:
还得修改你的app\design\frontend\base\default\template\reviewform.phtml 为其添加一个书写回复的文本  可以隐藏 因为你是后台给添加的…. (不然你的产品评论会报错的…..)
<input type=”text” name=”reply” id=”summary_field” value=”<?php echo $this->htmlEscape($data->getTitle()) ?>” />

1.6需要改:

的是:/app/code/core/Mage/Review/Model/Resource/Review.php这个文件,,,文件路径不一样,。改法都一样,,稍微有了些变化

/app/code/core/Mage/Review/Model/Resource/Review/Collection.php



Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐