Jump to content

[Solved] Star rating under product name


Recommended Posts

I looked for a way to add the stars under the product name. I have found a thread that suggests to add the following to product-list.tpl:

{hook h='displayProductListReviews' product=$product}

I checked my product-list.tpl out and there is already a line of code like that. I added this:

<p class="testme">{hook h='displayProductListReviews' product=$product}</p>

and then I checked the sourcecode of the rendered page. It said:

<p class="testme"></p>

Looks like the hook doesn't produce any output. How come? I already checked "modules/positions", because I thought I maybe needed to hook the productcomments module to the "displayproductlistreviews" hook, but I found out that there is NO such hook available in the list (at modules/positions).

 

Can anyone help me to get the star ratings on my product list page?

Edited by Administratоr (see edit history)
Link to comment
Share on other sites

Clear cache and recompile and it should work

I didn't add the code, it was already there, so I'm not sure if recompiling was needed. That's why I added the paragraph tags to check if the hook had any output. The paragraph tags were in the page source (thus recompilation succeeded) and now I'm (relatively) sure the hook just doesn't produce output. I never saw any stars since I updated to 1.6 and I didn't change a thing to the default theme.

 

Any thoughts? I cleared the cache several times in order to have some other functions working so that should have made the stars visible as well, but they aren't there.

 

Dioniz, do you have the "displayProductListReviews" hook in your backoffice/modules/positions?

Edited by Administratоr (see edit history)
Link to comment
Share on other sites

No i don't have it and it's ok. It's because it's kinda virtual hook

 

Have you turned on Product Comments module? And make some comment and approve it and then see if it work. If i remember it show stars only if there is some comment.

Link to comment
Share on other sites

No i don't have it and it's ok. It's because it's kinda virtual hook

 

Have you turned on Product Comments module? And make some comment and approve it and then see if it work. If i remember it show stars only if there is some comment.

 

I'm using the module since 1.5 - there are already comments made. There is also an average rating on the product page itself (with "read reviews / write your review here" link. But no luck on the product-list pages. :(

 

I'm scared to "reset" the module - I don't want to lose my valuable comments.

Link to comment
Share on other sites

Yes it works on clean too. Can you check if you have all this files in yourtheme/modules/productcomments/

 

  • productcomments.tpl
  • productcomments_reviews.tpl
  • productcomments_top.tpl
  • productcomments-extra.tpl
  • products-comparison.tpl
  • tab.tpl
Link to comment
Share on other sites

 

Yes it works on clean too. Can you check if you have all this files in yourtheme/modules/productcomments/

 

  • productcomments.tpl
  • productcomments_reviews.tpl
  • productcomments_top.tpl
  • productcomments-extra.tpl
  • products-comparison.tpl
  • tab.tpl

 

I have these:

productcomments-extra.tpl
	
productcomments.tpl
	
productcomments_reviews.tpl
	
productcomments_top.tpl (this one is 0 bytes!!)
	
products-comparison.tpl
	
tab.tpl
Link to comment
Share on other sites

I just tried to reset my module and it asked me: Would you like to delete the content related to this module ? I clicked No and it did't delete my comments. You can try that too but i suggest you to backup database before doing that.

  • Like 1
Link to comment
Share on other sites

Great news, I solved this by not being a pussy and resetting the module anyway... I selected "no, keep all data and only reset parameters". This resulted in an error (module can not be reset) and the module appeared to be uninstalled. I reinstalled the module. All my comments are still there and when I refreshed the page, I saw the star ratings on every page! Great stuff.

 

Looks like the displayProductListReviews hook had to be 'registered' somehow before it could work, by resetting / reinstalling the module.

 

Thanks to Dioniz for your help! Much appreciated!

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...