Keyword

[SOLVED] Item rating on Generic page

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 3 months ago #145134 by jozsefke
Replied by jozsefke on topic Item rating on Generic page
Yes, the Joomla template I'm using already has its own overrides for K2. Those are the ones I have modified, and I also have to write them in the changelog, since the template can be updated as well as Joomla or K2. Thank you for your kind help!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #145135 by Krikor Boghossian
Replied by Krikor Boghossian on topic Item rating on Generic page
You 're welcome :)
Since you know your way around coding why not give bitbucket.org/ for hosting code a try?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • jozsefke
  • jozsefke's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 3 months ago #145161 by jozsefke
Replied by jozsefke on topic Item rating on Generic page
Thank you, I'll take a look into that!

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

More
9 years 2 months ago - 9 years 2 months ago #145843 by razen
Replied by razen on topic Item rating on Generic page
I hope you wont blame me for grave-digging since I got exactly the same problem but can't fix it with this advice.

My actual code in a custom template is this:
<!-- RATING START -->
		<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="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
				<li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
				<li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
				<li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
				<li><a href="#" data-id="<?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>
	<!-- RATING END -->

Those are my edits to the item.php in the models-folder:
if (($view == 'item' && $item->params->get('itemRating')) ||  $task == 'search' || ($view == 'itemlist' && ($task == '' || $task == 'category' ) && $item->params->get('catItemRating')))
		{
			$item->votingPercentage = $this->getVotesPercentage($item->id);
			$item->numOfvotes = $this->getVotesNum($item->id);

		}

But the result: Empty 5 stars and the vote don't work.

Here's the link: minecraft-heads.com/heads/itemlist/search?searchword=Phoenix&categories=

Same problem with the tag-page where I tried the same: minecraft-heads.com/bird

Thanks for the help :)
Last edit: 9 years 2 months ago by razen.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 2 months ago #145892 by Krikor Boghossian
Replied by Krikor Boghossian on topic Item rating on Generic page
Hello,

Instead of $this->item->id you should use $item->id.
Also for the tag you should add $task == 'tag' to the model.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
9 years 2 months ago #145914 by razen
Replied by razen on topic Item rating on Generic page
worked at tag-page and search-page, thanks! :)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 2 months ago #145923 by Krikor Boghossian
Replied by Krikor Boghossian on topic Item rating on Generic page
You 're welcome Razen :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum