VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: lindapowers on February 27, 2016, 14:18:59 PM

Title: Max reviews displayed per product limited in frontend
Post by: lindapowers on February 27, 2016, 14:18:59 PM
Hello

Where does VirtueMart limit the reviews to 10 displayed???

We have products with many more reviews in the backend but the frontend only shows 10 and I have no clue where the limit comes from.

Is this limited by the core? in what file please?

Regards

VM 3.0.12 joomla 3.4.8
Title: Re: Max reviews displayed per product limited to 10
Post by: Jörgen on February 27, 2016, 14:33:46 PM
Hello

I found this in the templates/hera_j3_vm3/html/com_virtuemart/productdetails/default_reviews.php

$ratingsShow = VmConfig::get( 'vm_num_ratings_show', 3 ); // TODO add  vm_num_ratings_show in vmConfig


Try to add vm_num_ratings_show in vmconfig. In this case default seems to be three.

regards

Jörgen @ Kreativ Fotografi
Title: Re: Max reviews displayed per product limited to 10
Post by: lindapowers on February 27, 2016, 14:46:50 PM
Quote from: Jörgen on February 27, 2016, 14:33:46 PM
Hello

I found this in the templates/hera_j3_vm3/html/com_virtuemart/productdetails/default_reviews.php

$ratingsShow = VmConfig::get( 'vm_num_ratings_show', 3 ); // TODO add  vm_num_ratings_show in vmConfig


Try to add vm_num_ratings_show in vmconfig. In this case default seems to be three.

regards

Jörgen @ Kreativ Fotografi

Thanks, Im looking at same file, and already changed:

$showall = vRequest::getBool( 'showall', FALSE );
to
$showall = vRequest::getBool( 'showall', TRUE );


Which directly removes the initial limit of 3 and gest rid of the "more reviews" link, I tried changing the number of the code you suggested but doesn't seem to affect in the global number of reviews shown.

I tested in default beez template and it limits reviews displayed to 10 also so seems to come directly from VM... but where?

Regards
Title: Re: Max reviews displayed per product limited to 10
Post by: Jörgen on February 27, 2016, 15:14:09 PM
Hello

You are correct, I can´t see any limitation in the template file. I checked the model that load the ratings:
administrator/components/com_virtuemart/models/ratings.php

But I can´t say that I can see any limitation there either. Are You sure You have more than 10 published reviews ?

regards

Jörgen @ Kreativ Fotografi
Title: Re: Max reviews displayed per product limited to 10
Post by: lindapowers on February 27, 2016, 15:23:16 PM
Yes, take a look

http://www.comenaranjas.com/en/shop/oranges/table-oranges-kg-detail.html

And another one

http://www.comenaranjas.com/en/shop/oranges/juice-oranges-kg-detail.html

In the backend I have nearly 30 reviews for one of them and like 20 for the other one.

A bit strange that both show exactly 10 no?

I even checked in the database table for vm config but don't see any limit there either.

Regards
Title: Re: Max reviews displayed per product limited to 10
Post by: Jörgen on February 27, 2016, 16:26:23 PM
Hello again

This is strange, I have now added new entries into the database, duplicating an already entered review and I can see a total of 11 entries. Don´t see any limit of 10. You have no other thing affecting this. I noticed the review module. Is it possible this is interfering with Your other reviews ? Try unpublishing this module and test again. Don´t forget to clear cache.

regards

Jörgen @ Kreativ Fotografi
Title: Re: Max reviews displayed per product limited to 10
Post by: lindapowers on February 27, 2016, 19:32:01 PM
Thanks, I tried unpublishing the module but without effect.

I can't think of anything that could affect the max reviews shown per product... an X-file seems, if you tell me you can show more than 10.

Strange thing is that rich snippets in google actually read all the reviews but in the page only 10 are displayed per product max hmmmm.

Regards
Title: Re: Max reviews displayed per product limited to 10
Post by: GJC Web Design on February 27, 2016, 21:57:13 PM
the ratings query uses the stock vm query function

$this->exeSortSearchListQuery(0,' r.*,pr.`product_name` ',$tables,$whereString,'',$this->_getOrdering());

the last parameter isn't passed

public function exeSortSearchListQuery($object, $select, $joinedTables, $whereString = '', $groupBy = '', $orderBy = '', $filter_order_Dir = '', $nbrReturnProducts = false )

so it takes it from your pagination setting

if($nbrReturnProducts){
         $limitStart = 0;
         $limit = $nbrReturnProducts;
         $this->_withCount = false;
      } else if($this->_noLimit){
         $this->_withCount = false;
         $limitStart = 0;
         $limit = 0;
      } else {
         $limits = $this->setPaginationLimits();
         $limitStart = $limits[0];
         $limit = $limits[1];
      }

assume that's 20?
Title: Re: Max reviews displayed per product limited to 10
Post by: lindapowers on February 27, 2016, 22:12:12 PM
Hi GJC

Thanks! You found it, we had 10 set in frontend default items per view

(http://s29.postimg.org/tk3cpwt1j/pagi_rev.jpg)

Increasing that number increases the reviews shown,

Regards
Title: Re: Max reviews displayed per product limited to 10
Post by: GJC Web Design on February 27, 2016, 22:24:15 PM
I guess a separate config would be nice for this.....

in config

vm_num_ratings_show=xx

components\com_virtuemart\views\productdetails\view.html.php ~ line 234

$this->rating_reviews = $ratingModel->getReviews($product->virtuemart_product_id, 0, VmConfig::get( 'vm_num_ratings_show', 10));


administrator\components\com_virtuemart\models\ratings.php ~ 144

function getReviews($virtuemart_product_id, $virtuemart_vendor_id = 0, $num_ratings){

administrator\components\com_virtuemart\models\ratings.php ~ 168

$reviews[$hash] = $this->exeSortSearchListQuery(0,$select,$tables,$whereString,'',$this->_getOrdering(), $num_ratings);
Title: Re: Max reviews displayed per product limited to 10
Post by: Milbo on February 27, 2016, 22:34:25 PM
Thank you,

added VmConfig::get( 'vm_num_ratings_show', 3 ) to getReviews function
Title: Re: Max reviews displayed per product limited in frontend
Post by: lindapowers on March 14, 2016, 01:24:33 AM
Quote from: Milbo on February 27, 2016, 22:34:25 PM
Thank you,

added VmConfig::get( 'vm_num_ratings_show', 3 ) to getReviews function

Hello I just installed 3.0.14 but I can't find an option in the backend to set the max reviews shown.

Is there a new setting for this somwhere?

Regards
Title: Re: Max reviews displayed per product limited in frontend
Post by: Milbo on March 14, 2016, 01:49:06 AM
is a hidden one atm
Title: Re: Max reviews displayed per product limited in frontend
Post by: lindapowers on March 14, 2016, 02:08:19 AM
Quote from: Milbo on March 14, 2016, 01:49:06 AM
is a hidden one atm

Thanks, I tried to add:

vm_num_ratings_show=xx

In virtuemart.cfg but didnt work for me,

Regards
Title: Re: Max reviews displayed per product limited in frontend
Post by: Studio 42 on March 14, 2016, 09:24:15 AM
@lindapowers : Have you save the config ?
Title: Re: Max reviews displayed per product limited in frontend
Post by: lindapowers on March 14, 2016, 12:24:15 PM
Quote from: Studio 42 on March 14, 2016, 09:24:15 AM
@lindapowers : Have you save the config ?

Ouch thank you Patrick you are right, I had just edited and uploaded virtuemart.cfg without saving config in backend.

I added:
vm_num_ratings_show=40 in virtuemart.cfg saved backend config in vm and now it works,

Thanks