所以我想出了如何在产品页面上显示产品评论。现在我需要了解如何限制显示的评论数量并将“阅读更多评论”链接添加到产品评论默认页面。
有任何想法吗?或者谁能指出我正确的方向?我尝试了许多不同的脚本,但都没有运气。
更新:我尝试在下面进行更改,但仍然无法正常工作 - 关于我做错了什么的任何想法?
是的,这就是我的想法,但它仍然无法正常工作,任何想法我做错了什么?
<?php $_items = $this->getReviewsCollection()->setPageSize('5')->getItems();?>
<div class="box-collateral box-reviews" id="customer-reviews">
<?php if (count($_items)):?>
<div class="box-title">
<h2><?php echo $this->__('Customer<br><span id="smallH2">Reviews</span>') ?></h2>
</div>
<?php echo $this->getChildHtml('toolbar') ?>
<dl class="box-content" id="product-reviews-list">
<?php foreach ($_items as $_review):?>
<dt>
<?php
$reviewURL = $this->getReviewUrl($_review->getId());
$reviewURL = str_replace("catalog","review",$reviewURL);
?>
<a href="<?php echo $reviewURL ?>"><?php echo $this->htmlEscape($_review->getTitle()) ?></a> <?php echo $this->__('Review by <span>%s</span>', $this->htmlEscape($_review->getNickname())) ?>
</dt>
<dd>
<table class="data-table review-summary-table">
<col />
<col />
<tbody>
<?php foreach ($_review->getRatingVotes() as $_vote): ?>
<tr>
<th class="label"><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
<td class="value">
<div class="rating-box">
<div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;">
</div>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p><?php echo nl2br($this->htmlEscape($_review->getDetail())) ?></p>
<p class="date"><?php echo $this->__('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?></p>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">decorateGeneric($$('#product-reviews-list dd'), ['last']);</script>
<?php endif;?>
<?php echo $this->getChildHtml('review_form') ?>
</div>