Jump to content

Adding Star Ratings to Category Page 1.6


Dove99x

Recommended Posts

I'm currently having issues getting star ratings to show up under the categories pages. I was currently reviewing an article written by @NemoPS title "Display Product rating in the products list in Prestashop" and encountered an issue with the ratings or the hook showing up. I'm under the assumption that its due to the version of the Product Comments we have which is v3.6 but I'm not to sure.

I have come across another hook named displayProductListReviews but for some reason it does not show up unless its in grid mode when referenced under the Categories page. I'm currently only interested in having it seen in list mode rather than grid.

What can be done?

                {capture name='displayProductListReviews'}{hook h='displayProductListReviews' product=$product}{/capture}
                    {if $smarty.capture.displayProductListReviews}
                        {hook h='displayProductListReviews' product=$product}
                {/if}

Please, any help toward the right direction would help allot. 

    public function hookDisplayProductListReviews($params)
    {
        $id_product = (int) $params['product']['id_product'];
        if (!$this->isCached('productcomments_reviews.tpl', $this->getCacheId($id_product))) {
            require_once dirname(__FILE__).'/ProductComment.php';
            $average = ProductComment::getAverageGrade($id_product);
            $this->smarty->assign(array(
                'product' => $params['product'],
                'averageTotal' => round($average['grade']),
                'ratings' => ProductComment::getRatings($id_product),
                'nbComments' => (int) ProductComment::getCommentNumber($id_product),
            ));
        }

        return $this->display(__FILE__, 'productcomments_reviews.tpl', $this->getCacheId($id_product));
    }

Thank you. 

Edited by Dove99x (see edit history)
Link to comment
Share on other sites

Hey, thanks for using my tut!
Can you try returning just "hello" and see when the hook works, exactly? It should move over to the list with the switch function. Once you are sure it returns it, you can debug and see what's passed to $params using d($params) (it's gonna mess it up)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...