Peter.31 Posted July 23, 2021 Share Posted July 23, 2021 Can anyone advise me how to move the "Comments" tab between other tabs on the product page? Link to comment Share on other sites More sharing options...
juanrojas Posted July 23, 2021 Share Posted July 23, 2021 Hi, if you are just going to start I recommend that you do it with a good template, it will avoid a lot of headaches, think long term, for example the panda template And the reviews module they have can also be great for you because it complies with the structured data of google 1 Link to comment Share on other sites More sharing options...
Peter.31 Posted July 23, 2021 Author Share Posted July 23, 2021 Thank you very much for your answer. My eshop is online and I need to solve only this problem. I have not found any suitable solution yet. Link to comment Share on other sites More sharing options...
El Patron Posted July 23, 2021 Share Posted July 23, 2021 I would not worry about it at this time. In screen shot you only have demo data. rather than worry about comments, concentrate on building a catalog of products, shipping and checkout. then get a quality theme that has core features you want and has capability to include more feature. stop design, build functioning catalog, you will never make the default theme pretty or extend it's features.... Link to comment Share on other sites More sharing options...
Peter.31 Posted July 23, 2021 Author Share Posted July 23, 2021 On the picture above is only the demo version of PrestaShop front office. My eshop is fully online a few months and now I need to fix this problem. The module "Product Comments" by PrestaShop does not work properly because comments are visible at the end of product page. Comments should be visible together with a describtion and product details tabs. Link to comment Share on other sites More sharing options...
ComGrafPL Posted July 26, 2021 Share Posted July 26, 2021 On 7/23/2021 at 9:15 PM, Peter.31 said: On the picture above is only the demo version of PrestaShop front office. My eshop is fully online a few months and now I need to fix this problem. The module "Product Comments" by PrestaShop does not work properly because comments are visible at the end of product page. Comments should be visible together with a describtion and product details tabs. Can you show link to your store? Link to comment Share on other sites More sharing options...
Shabab Posted July 26, 2021 Share Posted July 26, 2021 Hi, Use this code in your module but before using this code you need to register this hook in your module. $this->registerHook('displayProductExtraContent'); public function hookDisplayProductExtraContent($params) { $array = array(); $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent()) ->setTitle('tittle') ->setContent('content'); return $array; } Link to comment Share on other sites More sharing options...
Peter.31 Posted July 26, 2021 Author Share Posted July 26, 2021 1 hour ago, uzishabab said: Hi, Use this code in your module but before using this code you need to register this hook in your module. $this->registerHook('displayProductExtraContent'); public function hookDisplayProductExtraContent($params) { $array = array(); $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent()) ->setTitle('tittle') ->setContent('content'); return $array; } Where exactly should I insert the code? public function hookDisplayProductExtraContent($params) { $array = array(); $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent()) ->setTitle('tittle') ->setContent('content'); return $array; } 1 Link to comment Share on other sites More sharing options...
Shabab Posted July 26, 2021 Share Posted July 26, 2021 You need to insert this code in module core file file productcomments.php Link to comment Share on other sites More sharing options...
Peter.31 Posted July 26, 2021 Author Share Posted July 26, 2021 On which line am I supposed to add that code? Link to comment Share on other sites More sharing options...
Shabab Posted July 26, 2021 Share Posted July 26, 2021 32 minutes ago, Peter.31 said: On which line am I supposed to add that code? Are you developer ? You need to customize this code according to your need . You need to add this inside the class. If you are not able to do this let us know in private . thanks Link to comment Share on other sites More sharing options...
Peter.31 Posted July 26, 2021 Author Share Posted July 26, 2021 You can edit the productcomments.php file? Thank you. productcomments.php Link to comment Share on other sites More sharing options...
Shabab Posted July 26, 2021 Share Posted July 26, 2021 Here is modified file . After adding this file, go to module configuration and click on save button and then refresh product page and test it productcomments.php Link to comment Share on other sites More sharing options...
Peter.31 Posted July 26, 2021 Author Share Posted July 26, 2021 Thanks for editing the file, but it doesn't work. After updating the file, the product web page crashes. A white page with the words "Write your review" will appear. Link to comment Share on other sites More sharing options...
Shabab Posted July 26, 2021 Share Posted July 26, 2021 1 minute ago, Peter.31 said: Thanks for editing the file, but it doesn't work. After updating the file, the product web page crashes. A white page with the words "Write your review" will appear. Enable debug mode and send me screenshot Link to comment Share on other sites More sharing options...
Peter.31 Posted July 26, 2021 Author Share Posted July 26, 2021 Screenshot in attachment. Write your review error.pdf Link to comment Share on other sites More sharing options...
SmartDataSoft Posted July 26, 2021 Share Posted July 26, 2021 @Peter.31 I have modify the file you can now play here is the final output public function hookDisplayProductExtraContent($params) { $pro = $params['product']; $id_lang = $this->context->language->id; // Load Product object $id_product = $pro->id; $product = new Product($id_product, false, $id_lang); /** @var ProductCommentRepository $productCommentRepository */ $productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository'); $averageGrade = $productCommentRepository->getAverageGrade($id_product, Configuration::get('PRODUCT_COMMENTS_MODERATE')); $commentsNb = $productCommentRepository->getCommentsNumber($id_product, Configuration::get('PRODUCT_COMMENTS_MODERATE')); $isPostAllowed = $productCommentRepository->isPostAllowed($id_product, (int) $this->context->cookie->id_customer, (int) $this->context->cookie->id_guest); $this->context->smarty->assign(array( 'post_allowed' => $isPostAllowed, 'usefulness_enabled' => Configuration::get('PRODUCT_COMMENTS_USEFULNESS'), 'average_grade' => $averageGrade, 'nb_comments' => $commentsNb, 'list_comments_url' => $this->context->link->getModuleLink('productcomments', 'ListComments', ['id_product' => $id_product]), 'update_comment_usefulness_url' => $this->context->link->getModuleLink('productcomments', 'UpdateCommentUsefulness'), 'report_comment_url' => $this->context->link->getModuleLink('productcomments', 'ReportComment'), )); $content = $this->context->smarty->fetch('module:productcomments/views/templates/hook/product-comments-list.tpl'); $array = array(); $array[] = (new PrestaShop\PrestaShop\Core\Product\ProductExtraContent()) ->setTitle('Comments (0)') ->setContent($content); return $array; } Now need some fine tune Thank you 1 Link to comment Share on other sites More sharing options...
Peter.31 Posted July 26, 2021 Author Share Posted July 26, 2021 Thanks, maybe I can fine-tune it. Link to comment Share on other sites More sharing options...
SmartDataSoft Posted July 26, 2021 Share Posted July 26, 2021 1 hour ago, Peter.31 said: Thanks, maybe I can fine-tune it. Do not forget to post the final out put code, which may help other. Mark the post as solve and click the love icon to the solution. Thank you Link to comment Share on other sites More sharing options...
Sharak Posted December 27, 2021 Share Posted December 27, 2021 (edited) Thanks, @SmartDataSoft. I've been fighting this 💩 whole day. It did load but also generated a ton of errors in the log about undefined index 'product' or using private methods. Your code finaly works as expected. You're a savior! ❤ ...at least it's a good start. Unfortunately modal doesn't load. Reviews show inside product tabs, but are unsuable How can I use these freakin' {widget} thing? 😡 Edited December 27, 2021 by Sharak (see edit history) Link to comment Share on other sites More sharing options...
altaiir123 Posted January 20, 2022 Share Posted January 20, 2022 @Sharak You need to edit one more line(918) in productcomments.php to fix your problem. public function hookDisplayFooterProduct($params) { return $this->renderProductCommentsList($params['product']) . $this->renderProductCommentModal($params['product']); } This is hook which displays old product comment section and modal. We only want to disable the duplicate comment section and not touch the modal, so the final version should look like this: public function hookDisplayFooterProduct($params) { return $this->renderProductCommentModal($params['product']); } This modification should keep the modal and allow to add new comments. I didn't test this solution extensively so let me know if it works. Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now