/[your_theme] /template/review/product/view/list.phtml*
다음과 같은 Foreach 루프 볼 수
:
<?php foreach ($_votes as $_vote): ?>
<tr>
<th><?php echo $this->escapeHtml($_vote->getRatingCode()) ?></th>
<td>
<div class="rating-box">
<div class="rating" style="width:<?php echo $_vote->getPercent() ?>%;"></div>
</div>
</td>
</tr>
<?php endforeach; ?>
을
이것은 각 투표를 반복하여 별표 등급으로 출력합니다. 다음
변경을 :
이
<?php
$_percent = 0;
foreach ($_votes as $_vote) {
$_percent = $_percent + $_vote->getPercent();
}
$_percent = $_percent/count($_votes);
?>
<tr>
<th>Aggregate rating:</th>
<td>
<div class="rating-box">
<div class="rating" style="width:<?php echo $_percent ?>%;"></div>
</div>
</td>
</tr>
대신 각 투표를 표시하는, 당신은 지금 집계 비율을 계산하고, 하나의 투표를 출력하고 있습니다.
대단히 감사합니다! 이것은 완벽하게 작동했습니다! –