·

photo credit: mag3737 via photopin cc

Put the star rating element of a product in Magento – anywhere!

I was looking for a solution to put the star rating element of a product in Magento on any given location. As most of you know, you can simply display the star rating element of a product (you know, the one with the five stars on a row) on a template like a product detail page or product list. But what if you have a product displayed elsewhere else and you just need to display the five stars without having access to the getReviewsSummaryHtml()-function?
Inchoo already covered an interesting article about how to get the summary information anywhere, but I am solely interested in the five-star element. So, how can we achieve this? Well, here is how:

Easy isn’t it?

Visitors give this article an average rating of -8,399.8 out of 5.

How would you rate this article?

5 thoughts on “Put the star rating element of a product in Magento – anywhere!”

  1. marcobax22 says:

    Handige tip, ik wacht met smart op meer !

  2. Sheldon says:

    What file are you editing ?

    Thanks Again

    1. Giel Berkers says:

      No file in particular. As the article stated, you can put the star rating element anywhere. So as long as you have a phtml file with a loaded product ($loaded_product in this example), you can use this code.

  3. subhranil says:

    Ooooo… It’s working…. Thanks a lot!!!!

  4. Tim says:

    Great – working first time, thank you. Saved me a load of time

Leave a Reply