Post by ryanctc » Fri Oct 22, 2021 8:29 pm

Good afternoon,

Opencart Version 2.1.0.1

I have added the star rating to the category page but I cannot work out how to add the quantity for reviews such as "1 Review" the same as the product page.

I presume the files I need to edit are?

view/theme/default/template/product/category.tpl

and

catalog/controller/product/category.php

but I am unsure of the correct code required? Thank you for any help.
Last edited by ryanctc on Thu Oct 28, 2021 8:53 pm, edited 1 time in total.

Newbie

Posts

Joined
Thu Jun 11, 2020 7:30 pm

Post by grgr » Fri Oct 22, 2021 10:12 pm

You should be able to just add

Code: Select all

	'review_count'  => $result['reviews'],
to the array:

Code: Select all

	$data['products'][] = array(
I think.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by ryanctc » Tue Oct 26, 2021 11:56 pm

Thanks grgr for the reply,

I gave it ago and says: Undefined variable: review_count

have I missed something? tried a few things and it doesn't seem to want to display.

Newbie

Posts

Joined
Thu Jun 11, 2020 7:30 pm

Post by Cue4cheap » Thu Oct 28, 2021 8:49 am


cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by ryanctc » Thu Oct 28, 2021 6:44 pm

Thank you, I have checked that post out but it doesn't seem to work. Completing the instructions it returns : tab_review and not the count.

Newbie

Posts

Joined
Thu Jun 11, 2020 7:30 pm

Post by straightlight » Thu Oct 28, 2021 7:34 pm

ryanctc wrote:
Thu Oct 28, 2021 6:44 pm
Thank you, I have checked that post out but it doesn't seem to work. Completing the instructions it returns : tab_review and not the count.
Ensure to use:

Code: Select all

<?php echo $product['review_count']; ?>
in your category.tpl file once added the modification in your controller above. In addition, since you're using a golden age version of Opencart, it would be best to upgrade in order to use OCMod or Event Triggers to avoid manipulating core files.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ryanctc » Thu Oct 28, 2021 8:52 pm

Thank you, that did the trick!

Upgrading is way past my knowledge but we will look at getting someone to do this for us next year as our website is becoming very big.

Newbie

Posts

Joined
Thu Jun 11, 2020 7:30 pm
Who is online

Users browsing this forum: No registered users and 52 guests