Prestashop: Product Comments - Reviews are displayed only on the first instance of a product on the Homepage

Created on 26 Jul 2019  路  17Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
Issue reported here: https://github.com/PrestaShop/PrestaShop/issues/14827#issuecomment-514994659
The module displays reviews only on first instance of a product on homepage
To Reproduce
Steps to reproduce the behavior:

  1. Install Product Comments module
  2. Approve some reviews for some products
  3. ps_featuredproducts is installed => reviews are well displayed
    image
  1. Try to install the ps_bestsellers module
    => reviews are not displayed
    image

  2. If you try to change the position of the two modules

Reviews are displayed in the first instance only

image

Additional information
PrestaShop version: 1.7.6.0
PHP version: 7.1

1.7.6.0 Bug FO Fixed Minor PR available Productcomments

All 17 comments

ping @jolelievre

In relation to this issue, the reviews are also not displayed on category page while using pagination.

To Reproduce

  1. Go to any category page which has pagination and should also have a product with reviews on page-(1).
  2. Use pagination and go to page-(2).
  3. Go back to page-(1) and notice that reviews are not displayed for that product.

I'm not sure why @jolelievre in this hook: displayProductListReviews, gets reviews using ajax request?

Hi, I used ajax because of the cache on some pages (especially on homepage), in order to have the latest datas about product rating. But I didn't think there could be two instances of the same product in one page, so my selector probably only targets the first one.

And there is definitely another related bug with the category pagination. I will look into it asap and will probably drop the ajax feature. So the datas might not be as fresh as they were, but it will probably be better for SEO as well. Unless I clear the cache at each comment validation but I'm worried of the performance drawback..

This is why i asked you about cache some time ago, i didn't noticed that you have ratings loaded via ajax 馃槅

in my opinion, for performance wise, and for PrestaShop overall, would be better to have it loaded properly in displayProductListReviews, same as before in PrestaShop 1.6, i have homepage with over 100 products on it, it's not good for performance and page is a little laggy at first load

Yeah I think you're right. Besides I think it's ok if the cache is cleared when the comment is validated, I guess usually the administrator will approve the comments by dozens once per day. It's not like any comment post from the front office would clear the cache.

@jolelievre the problem is that you can't really clear cache due to PrestaShop bug :)

you need to clear cache of every homepage module, because if you clear only cache of the productcomments module it will not work, i've reported this problem some times ago, if you clear cache of displayProductListReviews hook modules, not a single template file with this hook inside is actually refreshed...

clearing entire shop cache, even while approving comment, is not a good idea, some bigger shops, with additional modules like Advanced Search have millions of cache files ;)

@kpodemski oh I see, actually I was thinking of clearing the whole smarty cache But you think it's too heavy? Or is there another cache I should clean?
I admit not having a big experience in PrestaShop legacy cache
How can I know the cache policy of each module?

@jolelievre

it's not safe to clear entire cache using Tools::clearSmartyCache, it's too heavy sometimes, up to few gigs...

for the legacy caching you can see Module entity and _clearCache method.

Also, it's worth to see legacy version of productcomments module, old version for 1.6

Hello,
@khouloudbelguith, i noticed one more problem:
The native module "Featured products" can displayed on confirmation page too:
http://prntscr.com/orbizx
But the plugin "jquery.rating.plugin.js" doesn't include on confirmation page in file "productcomments.php":
http://prntscr.com/orbjhw
This plugin included only for next pages:

  • Product page;
  • Listing pages;
  • Index page;

Hello,
@khouloudbelguith, i noticed one more problem:
The native module "Featured products" can displayed on confirmation page too:
http://prntscr.com/orbizx
But the plugin "jquery.rating.plugin.js" doesn't include on confirmation page in file "productcomments.php":
http://prntscr.com/orbjhw
This plugin included only for next pages:

  • Product page;
  • Listing pages;
  • Index page;

Hello,
@khouloudbelguith, also the "Featured products" displayed in hook "displayCrossSellingShoppingCart" on the page "Cart empty". So it is need to add the file jquery.rating.plugin.js to the page "Cart empty" too.
Screenshot_1

Hello @khouloudbelguith,

In new version of PrestaShop 1.7.6.1 a new errors occur in settings of module "Product comments". You can see it with "Debug mode" only.
Screenshot_2

Hi @web-burn,

Issue reported here: https://github.com/PrestaShop/PrestaShop/issues/15318

Thanks!

@khouloudbelguith PR available

@jolelievre should review Oksydan PR I think, that would be better since he worked on that subject too, looks like everything should be done there

@PrestaShop/prestashop-core-developers this is ready and merged thanks to @Oksydan

Fixed by PrestaShop/productcomments#42

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wikao2 picture wikao2  路  3Comments

centoasa picture centoasa  路  3Comments

matks picture matks  路  3Comments

marionf picture marionf  路  3Comments

itisco picture itisco  路  3Comments