test
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • chefacademy Friend
    #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 it

    Ninja Lead Moderator
    #533838

    I 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

    chefacademy Friend
    #534044

    Thanks 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


    1. Schermata-05-2456785-alle-19.35.56
    2. Schermata-05-2456785-alle-19.33.28
    Ninja Lead Moderator
    #534149

    To 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.

    chefacademy Friend
    #536674

    Please help me! How can I hide “Number of Votes”?

    Ninja Lead Moderator
    #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; ?>

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, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum