Logical error in vote/mini.php

  • Posts: 382
  • Thank you received: 77
7 years 6 months ago #251717

-- HikaShop version -- : 2.6.4

Hi,

I tested the new version Hikashop (2.6.4) and got the wrong display of the product pages.

I spent some time to check it and now I found a reason of it.

There is an logical error in vote/mini.php view.

Here is lines 65-85:

if ($row->hikashop_vote_total_vote > 0) {
?>
	<div style="display: none;">
		<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
			<span itemprop="ratingValue"><?php echo $row->hikashop_vote_average_score; ?></span>
			<span itemprop="bestRating"><?php echo $row->hikashop_vote_nb_star; ?></span>
			<span itemprop="ratingCount"><?php echo $row->hikashop_vote_total_vote; ?></span>
			<span itemprop="itemReviewed">Product</span>
		</div>
	</div>
	<div class="hk-rating" data-original-title="<?php echo $tooltip; ?>" data-toggle="hk-tooltip">
<?php
	}
	for($i = 1; $i <= $row->hikashop_vote_average_score_rounded; $i++) {
		echo '<span class="hk-rate-star state-full"></span>';
	}
	for($i = $row->hikashop_vote_average_score_rounded; $i < $row->hikashop_vote_nb_star; $i++) {
		echo '<span class="hk-rate-star state-empty"></span>';
	}
?>
	</div>

If ($row->hikashop_vote_total_vote > 0) is wrong, we have </div> without <div class="hk-rating"...

And I did it so:
if ($row->hikashop_vote_total_vote > 0) {
?>
	<div style="display: none;">
		<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
			<span itemprop="ratingValue"><?php echo $row->hikashop_vote_average_score; ?></span>
			<span itemprop="bestRating"><?php echo $row->hikashop_vote_nb_star; ?></span>
			<span itemprop="ratingCount"><?php echo $row->hikashop_vote_total_vote; ?></span>
			<span itemprop="itemReviewed">Product</span>
		</div>
	</div>
<?php
	}
?>
	<div class="hk-rating" data-original-title="<?php echo $tooltip; ?>" data-toggle="hk-tooltip">
<?php
	for($i = 1; $i <= $row->hikashop_vote_average_score_rounded; $i++) {
		echo '<span class="hk-rate-star state-full"></span>';
	}
	for($i = $row->hikashop_vote_average_score_rounded; $i < $row->hikashop_vote_nb_star; $i++) {
		echo '<span class="hk-rate-star state-empty"></span>';
	}
?>
	</div>

Best regards

Last edit: 7 years 6 months ago by almika.

Please Log in or Create an account to join the conversation.

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
7 years 6 months ago #251776

Hi,

Thanks for the feedback. You're totally right. We've changed that on our end.

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum