Skip to main content

Voting stars and empty rating - My suggestion

More
8 years 6 months ago #290208 by almika
-- HikaShop version -- : 3.4.0

Hi, Hikashop Team!

After updating to 3.4.0 the gray stars don't showing to guests if the rating is empty.
For someone it's good, for others it's bad.

I suggest to change a small piece of code in vote template mini.php
Code:
if(!$canVote && $row->hikashop_vote_total_vote == '0'){ echo '<div class="hikashop_vote_stars">'.JText::_('HIKA_NO_VOTE').'</div>'; return; }

To:
Code:
if(!$canVote && $row->hikashop_vote_total_vote == '0'){ echo '<div class="hk-rating hk-rating-empty" data-original-title="'.JText::_('HIKA_NO_VOTE').'" data-toggle="hk-tooltip">'; for($i = 1; $i <= $row->hikashop_vote_nb_star; $i++) { echo '<span class="hk-rate-star state-empty"></span>'; } echo '</div>'; return; }

This will enable us to control the display of the empty rating via CSS styles, without creating an override for this view.
Code:
.hk-rating.hk-rating-empty { display: none; }

Perhaps you can include it in the next release.

Thank you
Best regards
The following user(s) said Thank You: Pierreco

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

More
8 years 6 months ago #290237 by nicolas
Hi,

Thank you for your feedback. That's a good idea.
However, we'll implement it like that:
Code:
if(!$canVote && $row->hikashop_vote_total_vote == '0'){ ?> <div class="hikashop_vote_stars"> <div class="hk-rating-empty-label"> <?php echo JText::_('HIKA_NO_VOTE'); ?> </div> <div class="hk-rating hk-rating-empty" data-original-title="<?php echo JText::_('HIKA_NO_VOTE'); ?>" data-toggle="hk-tooltip"> <?php for($i = 1; $i <= $row->hikashop_vote_nb_star; $i++) { echo '<span class="hk-rate-star state-empty"></span>'; } ?> </div>; </div> <?php return; }
So that people still have the "no votes" label by default and change change:
.hk-rating.hk-rating-empty {
display: none;
}
to:
.hk-rating-empty-label {
display: none;
}
to get the stars instead.
The following user(s) said Thank You: almika, Pierreco

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

More
8 years 6 months ago #290250 by almika
Hi, Nicolas!

Thank you for your answer.
Your code is more flexible than mine!

Best regards

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

Time to create page: 0.210 seconds
Powered by Kunena Forum