- Posts: 136
- Thank you received: 7
Vote and Comment: Display votes as compact on listing, vote avarage, vote total.
8 years 7 months ago - 8 years 7 months ago #290944
by flexsus
.ninja { color: black; visibility: hidden; }
In case of fire:
1. git commit
2. git push
3. exit building
Vote and Comment: Display votes as compact on listing, vote avarage, vote total. was created by flexsus
-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.6
-- PHP version -- : 7.0.10
Hi Hikashop
I would like to suggest the option to make a compact view of vote stars in listings. Like Fiverr.com does it:
And the option to show/hide vote avarage and vote total after the stars.
And I think 1 decimal in aggregateRating would be enough.
I can do this in view-override and I will do, but I hope some day this will be a feature in Hikashop. Then I can have as few overridden files as possible
Best regards,
Henrik
-- Joomla version -- : 3.8.6
-- PHP version -- : 7.0.10
Hi Hikashop
I would like to suggest the option to make a compact view of vote stars in listings. Like Fiverr.com does it:
And the option to show/hide vote avarage and vote total after the stars.
And I think 1 decimal in aggregateRating would be enough.
I can do this in view-override and I will do, but I hope some day this will be a feature in Hikashop. Then I can have as few overridden files as possible
Best regards,
Henrik
.ninja { color: black; visibility: hidden; }
In case of fire:
1. git commit
2. git push
3. exit building
Last edit: 8 years 7 months ago by flexsus.
Please Log in or Create an account to join the conversation.
8 years 7 months ago - 8 years 7 months ago #290963
by flexsus
.ninja { color: black; visibility: hidden; }
In case of fire:
1. git commit
2. git push
3. exit building
Replied by flexsus on topic Vote and Comment: Display votes as compact on listing, vote avarage, vote total.
Hi
Here is what my view override looks like now:
I did not find a way to call if I'm in a listing view or product/vendor view so that I could achieve only showing 1 star in listing view and all stars (5) in vendor/product detail page.
Modified code below.
Best regards,
Henrik
Here is what my view override looks like now:
I did not find a way to call if I'm in a listing view or product/vendor view so that I could achieve only showing 1 star in listing view and all stars (5) in vendor/product detail page.
Modified code below.
Best regards,
Henrik
Code:
<?php
/**
* @package HikaShop for Joomla!
* @version 3.4.0
* @author hikashop.com
* @copyright (C) 2010-2018 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
$row =& $this->rows;
$config = hikashop_config();
if($row->vote_enabled != 1)
return;
$voteAccess = $config->get('access_vote','public');
$user = hikashop_loadUser();
$hasBought = false;
if($voteAccess == 'buyed' && !empty($user)){
$voteClass = hikashop_get('class.vote');
$hasBought = $voteClass->hasBought($row->vote_ref_id, $user);
}
$canVote = $voteAccess == 'public' || ($voteAccess == 'registered' && !empty($user)) || ($voteAccess == 'buyed' && $hasBought);
if(!$canVote && $row->hikashop_vote_total_vote == '0'){
echo '<div class="hikashop_vote_stars"><span class="hk-rate-star state-full"></span><span class="hikashop_no_vote">'.JText::_('HIKA_NO_VOTE').'</span></div>';
return;
}
$row->hikashop_vote_average_score = round((float)hikashop_toFloat($row->hikashop_vote_average_score),1);
hikaInput::get()->set("rate_rounded",$row->hikashop_vote_average_score_rounded);
hikaInput::get()->set("nb_max_star",$row->hikashop_vote_nb_star);
$select_id = "select_id_".$row->vote_ref_id;
if(!empty($row->main_div_name)){
$select_id .= "_".$row->main_div_name;
}else{
$select_id .= "_hikashop_main_div_name";
}
if($row->hikashop_vote_total_vote == '0'){
$tooltip = JText::_('HIKA_NO_VOTE');
}else{
$user_rating = JText::_('HIKA_NO_VOTE');
if(isset($this->user_vote->vote_rating))
$user_rating = $this->user_vote->vote_rating;
$tooltip = "<span class='hikashop_vote_tooltip hikashop_vote_tooltip_average'><span class='hikashop_vote_tooltip_label'>".JText::_('VOTE_AVERAGE').": </span><span class='hikashop_vote_tooltip_value'>".$row->hikashop_vote_average_score."</span></span>";
$tooltip .= "<br><span class='hikashop_vote_tooltip hikashop_vote_tooltip_total'><span class='hikashop_vote_tooltip_label'>".JText::_('HIKA_VOTE_TOTAL').": </span><span class='hikashop_vote_tooltip_value'>".$row->hikashop_vote_total_vote."</span></span>";
$tooltip .= "<br><span class='hikashop_vote_tooltip hikashop_vote_tooltip_customer_vote'><span class='hikashop_vote_tooltip_label'>".JText::_('HIKA_VOTE_CUSTOMER_VOTE').": </span><span class='hikashop_vote_tooltip_value'>".$user_rating."</span></span>";
}
?>
<div class="hikashop_vote_stars">
<?php
if($config->get('enable_status_vote', 'vote') != 'both' && $canVote) {
?>
<input type="hidden" name="hikashop_vote_rating" data-votetype="<?php echo $row->type_item; ?>" data-max="<?php echo $row->hikashop_vote_nb_star; ?>" data-ref="<?php echo $row->vote_ref_id;?>" data-rate="<?php echo $row->hikashop_vote_average_score_rounded; ?>" data-original-title="<?php echo $tooltip; ?>" id="<?php echo $select_id;?>" />
<?php
if ($row->hikashop_vote_total_vote > 0) {
?>
<div class="hikashop_vote_aggregate">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue"><strong><?php echo $row->hikashop_vote_average_score; ?></strong></span>
<span itemprop="ratingCount">(<?php echo $row->hikashop_vote_total_vote; ?>)</span>
</div>
</div>
<?php
}
?>
<span id="hikashop_vote_status_<?php echo $row->vote_ref_id;?>" class="hikashop_vote_notification_mini"></span>
<?php
} else {
?>
<div class="hk-rating" data-original-title="<?php if ($canVote) { 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>
<?php
if ($row->hikashop_vote_total_vote > 0) {
?>
<div class="hikashop_vote_aggregate">
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue"><strong><?php echo $row->hikashop_vote_average_score; ?></strong></span>
<span itemprop="ratingCount">(<?php echo $row->hikashop_vote_total_vote; ?>)</span>
</div>
</div>
<?php }
}
?>
<input type="hidden" class="hikashop_vote_rating" data-rate="<?php echo $row->hikashop_vote_average_score_rounded; ?>" />
</div>
.ninja { color: black; visibility: hidden; }
In case of fire:
1. git commit
2. git push
3. exit building
Last edit: 8 years 7 months ago by flexsus.
The following user(s) said Thank You: Mohamed Thelji
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
8 years 7 months ago #290979
by Mohamed Thelji
Replied by Mohamed Thelji on topic Vote and Comment: Display votes as compact on listing, vote avarage, vote total.
Hello Henrik,
We'll take that into account, thank you for your feedback !
Best regards,
Mohamed Thelji.
I can do this in view-override and I will do, but I hope some day this will be a feature in Hikashop. Then I can have as few overridden files as possible
We'll take that into account, thank you for your feedback !
Best regards,
Mohamed Thelji.
Please Log in or Create an account to join the conversation.
Time to create page: 0.056 seconds