共计 1137 个字符,预计需要花费 3 分钟才能阅读完成。
magento本身是不带 回复评论的功能的,现成的扩展(无论免费的还是商业的)也没找到,那就自己写一个吧,花了一下午写完,自我感觉不错,拿出来晾晾
1. 数据库中review_detail表新增字段 reply
2. 修改Form.php文件,添加回复文本框, app/code/core/Mage/Adminhtml/Block/Review/Edit/Form.php 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
* //Alex add reply 2009-08-06
*/
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行
<p><?php echo nl2br($this->htmlEscape($_review->getDetail())) ?> <?php echo $this->__(‘(Posted on %s)’, $this->formatDate($_review->getCreatedAt()), ‘long’) ?></p> <?php //Alex add reply 2009-08-06 ?> <p style=”color: rgb(204, 0, 51);”><?php echo $this->__(‘Reply:’) ?><?php echo nl2br($this->htmlEscape($_review->getReply())) ?></p> |
完成!