-
AuthorPosts
-
May 5, 2014 at 10:51 pm #197426
Hi, I am doing a little change to my Ja_lens site. I decided to order a K2 Category List doing “r.rating_sum*r.rating_count” instead of “r.rating_sum/r.rating_count” in this way the Items are listed taking in to account the number of votes.
Now I would like to Publish the result of this calculation. I want to put the result of “r.rating_sum*r.rating_count” after “Number of Votes” and after the “stars” in the Item display. Please give me suggestion on how to do itNinja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
May 6, 2014 at 3:10 pm #533838I could not find any script to work with r.rating_sum/r.rating_count in K2 Category List in JA Lens Template. It would be great you can send me the screenshot and path php file to work with it. I shall help you to check it
May 7, 2014 at 5:43 pm #534044Thanks a lot for your reply.
I modified the 2 PHP files I attach the screenshot to show you also the path.
I would need to publish, close to the “rating stars”, the number resulting from the calculation.
You can see I put comment of the original formula. And made “*” intstead of “/”Ciao
-
Ninja Lead Moderator
Ninja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
May 8, 2014 at 9:05 am #534149To show the result r.rating_sum*r.rating_count after the “stars” in the Item display, you have to change it from the K2 item details, not K2 core.
Open the templates/ja_lens/html/com_k2/ja_lens/item.php and templates/ja_lens/html/com_k2/ja_lens_blog/item.php files, you will see this code:
<?php if($this->item->params->get('itemRating')): ?>
<!-- Item Rating -->
<div class="itemRatingBlock">
<span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span>
<div class="itemRatingForm">
<ul class="itemRatingList">
<li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li>
</ul>
<div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endif; ?>
You should also raise your case to K2 forum http://getk2.org/community/index, you might get better help there.
May 26, 2014 at 10:56 am #536674Please help me! How can I hide “Number of Votes”?
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
May 27, 2014 at 4:52 am #536771<em>@chefacademy 429263 wrote:</em><blockquote>Please help me! How can I hide “Number of Votes”?</blockquote>
+ Please navigate to category > Item view options and try to set “item view” option to “hide”
+ Or you can edit directly from php files
Open the templates/ja_lens/html/com_k2/ja_lens/item.php, templates/ja_lens/html/com_k2/ja_lens_blog/category_item.php, templates/ja_lens/html/com_k2/ja_lens_blog/item.php files, find and remove snippet below
<?php if($this->item->params->get('itemRating')): ?>
<!-- Item Rating -->
<div class="itemRatingBlock">
<span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span>
<div class="itemRatingForm">
<ul class="itemRatingList">
<li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li>
</ul>
<div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endif; ?>
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)This topic contains 6 replies, has 2 voices, and was last updated by Ninja Lead 10 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum