[Skip to main content](#vessel-content)

#   Vote statistics &amp; Report spam

##

- **[hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")**
- [![hawkeyentjc's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile") Topic Author
- [ Offline](/forum/user/6372-hawkeyentjc)

Less More

- Posts: 50
- Thank you received: 1
-
-

14 years 3 weeks ago [\#69842](#69842) by [hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")  *[Vote statistics &amp; Report spam](/forum/2-general-talk-about-hikashop/69842-vote-statistics-report-spam#69842 "Hi,  In the product vote &amp; comments section, is it already possible to achieve the following:  &#42; Vote Statistics: Display statistics of how many customers vote 1-star, 2-star, 3-star, and so on. (Refer to attached review-1.png)  &#42; Report Spam: A function for customers to report a comment as spam.(Refer to attached review-2.png)  If it's already achievable with the current version, I would like to know the steps to do it.  Thanks.")* was created by *[hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")*

Hi,

In the product vote &amp; comments section, is it already possible to achieve the following:

- **Vote Statistics:** Display statistics of how many customers vote 1-star, 2-star, 3-star, and so on. (Refer to attached review-1.png)
- **Report Spam:** A function for customers to report a comment as spam.(Refer to attached review-2.png)

If it's already achievable with the current version, I would like to know the steps to do it.

Thanks.

- [ ![review-1.png](/forum/attachment/6249) ](/forum/attachment/6249 "review-1.png") [ ](/forum/attachment/6249?download=1 "review-1.png")
- [ ![review-2.png](/forum/attachment/6250) ](/forum/attachment/6250 "review-2.png") [ ](/forum/attachment/6250?download=1 "review-2.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY5ODQyLXZvdGUtc3RhdGlzdGljcy1yZXBvcnQtc3BhbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

14 years 3 weeks ago -  14 years 3 weeks ago [\#69848](#69848) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Re: Vote statistics &amp; Report spam](/forum/2-general-talk-about-hikashop/69842-vote-statistics-report-spam#69848 "Hi,  In the product vote &amp; comments section, is it already possible to achieve the following:  &#42; Vote Statistics: Display statistics of how many customers vote 1-star, 2-star, 3-star, and so on. (Refer to attached review-1.png)  &#42; Report Spam: A function for customers to report a comment as spam.(Refer to attached review-2.png)  If it's already achievable with the current version, I would like to know the steps to do it.  Thanks.")*

Hi,

You can edit the file "yourSite\components\com_hikashop\&#96;views\product\view.html.php", and in the function "show()" add the code: Code:

$database = JFactory::getDBO(); $query = 'SELECT vote_rating FROM '.hikashop_table('vote').' WHERE vote_ref_id = '.$product_id; $database-&gt;setQuery($query); $votes = $database-&gt;loadResultArray(); $config = hikashop_config(); $total_star = $config-&gt;get('vote_star_number'); $rates = array(); foreach($votes as $vote){ for($i=1; $i &lt;= $total_star; $i++){ if($vote == $i){ $rates[$i]++; } } } for($i=1; $i &lt;= $total_star; $i++){ if(!isset($rates[$i]) &#124;&#124; $rates[$i] == null) $rates[$i] = 0; } krsort($rates); $this-&gt;assignRef('rates',$rates);

Just after: Code:

if(empty($product_id)){ if (is_object( $menu )) { jimport('joomla.html.parameter'); $category_params = new HikaParameter( $menu-&gt;params ); $product_id = $category_params-&gt;get('product_id'); JRequest::setVar('product_id',$product_id); } } if(empty($product_id)){ return; }

And then in the view "product / show_default" (in HikaShop &gt; Display &gt; Views), you have the variable "$this-&gt;rates" which have all the informations for your "vote statistics" point.

For the spam reporting, the functionality is not available for the moment.

Last edit: 14 years 3 weeks ago by [Xavier](/forum/user/4105-xavier "View Xavier's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY5ODQyLXZvdGUtc3RhdGlzdGljcy1yZXBvcnQtc3BhbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")**
- [![hawkeyentjc's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile") Topic Author
- [ Offline](/forum/user/6372-hawkeyentjc)

Less More

- Posts: 50
- Thank you received: 1
-
-

14 years 3 weeks ago [\#69867](#69867) by [hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")  Replied by *[hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")* on topic *[Re: Vote statistics &amp; Report spam](/forum/2-general-talk-about-hikashop/69842-vote-statistics-report-spam#69867 "Hi,  In the product vote &amp; comments section, is it already possible to achieve the following:  &#42; Vote Statistics: Display statistics of how many customers vote 1-star, 2-star, 3-star, and so on. (Refer to attached review-1.png)  &#42; Report Spam: A function for customers to report a comment as spam.(Refer to attached review-2.png)  If it's already achievable with the current version, I would like to know the steps to do it.  Thanks.")*

Thanks Xavier.

I've added the earlier code for view.html.php.

For the next part to add the variable "$this-&gt;rates", I'm not too familiar with what code to add. But is the code supposed to be something like this?

foreach($this-&gt;rates as $rates){echo $rates-&gt;.......}

The "......." part I'm not too sure what to call from. Are you able to guide on this?

Thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY5ODQyLXZvdGUtc3RhdGlzdGljcy1yZXBvcnQtc3BhbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

14 years 2 weeks ago [\#70035](#70035) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Vote statistics &amp; Report spam](/forum/2-general-talk-about-hikashop/69842-vote-statistics-report-spam#70035 "Hi,  In the product vote &amp; comments section, is it already possible to achieve the following:  &#42; Vote Statistics: Display statistics of how many customers vote 1-star, 2-star, 3-star, and so on. (Refer to attached review-1.png)  &#42; Report Spam: A function for customers to report a comment as spam.(Refer to attached review-2.png)  If it's already achievable with the current version, I would like to know the steps to do it.  Thanks.")*

You can do like that for example :

foreach($this-&gt;rates as $k =&gt; $rates){echo $rates.' votes for '.$k.' stars&lt;br/&gt;';}

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY5ODQyLXZvdGUtc3RhdGlzdGljcy1yZXBvcnQtc3BhbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")**
- [![hawkeyentjc's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile") Topic Author
- [ Offline](/forum/user/6372-hawkeyentjc)

Less More

- Posts: 50
- Thank you received: 1
-
-

14 years 2 weeks ago [\#70179](#70179) by [hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")  Replied by *[hawkeyentjc](/forum/user/6372-hawkeyentjc "View hawkeyentjc's Profile")* on topic *[Re: Vote statistics &amp; Report spam](/forum/2-general-talk-about-hikashop/69842-vote-statistics-report-spam#70179 "Hi,  In the product vote &amp; comments section, is it already possible to achieve the following:  &#42; Vote Statistics: Display statistics of how many customers vote 1-star, 2-star, 3-star, and so on. (Refer to attached review-1.png)  &#42; Report Spam: A function for customers to report a comment as spam.(Refer to attached review-2.png)  If it's already achievable with the current version, I would like to know the steps to do it.  Thanks.")*

Thanks for your guidance. The code works well!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzY5ODQyLXZvdGUtc3RhdGlzdGljcy1yZXBvcnQtc3BhbT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.099 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
