Jump to content

Hook product comments to new tab on product page


jgriff89

Recommended Posts

Hi

I am trying to hook the product comments module so the product comments / reviews show on a new tab on the products page along side the tabs for the description and product data sheet (features).

I can successfully create the new tab by adding the following to the module file productcomments.php:

Top of file: use PrestaShop\PrestaShop\Core\Product\ProductExtraContent;

Under class line:

public function hookdisplayProductExtraContent($params)
{        
    $array = array();
    $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent())
            ->setTitle('Reviews')
            ->setContent('content');
    return $array;
}

I have registered the hook in the module, but I can't get the module to display in the tab at all. I have tried various different things including changing ->setContent to  return $this->renderProductCommentsList($params['product']) . $this->renderProductCommentModal($params['product']); and also adding hooks for displayProductTab and displayProductTabContent into the product-tab.tpl and hooking the module to those hooks (I am using classic rocket theme, so has partial tpl files for product tabs).

Does anyone have any ideas?

Cheers

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...