From 181643661f6af172afd0ba74a5f3f45ad86800f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20H?= <nenes25@users.noreply.github.com>
Date: Thu, 17 Feb 2022 16:51:37 +0100
Subject: [PATCH 01/25] Delete CHANGELOG.txt

---
 CHANGELOG.txt | 4 ----
 1 file changed, 4 deletions(-)
 delete mode 100644 CHANGELOG.txt

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
deleted file mode 100644
index 03b9ea4e..00000000
--- a/CHANGELOG.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-2014-04-17 11:40:33 +0200	Bug fix (PS 1.5): ps_version_compliancy removed
-2014-04-15 18:54:08 +0200	[*] hookDisplayLeftColumnProduct() added
-2014-04-09 18:28:59 +0200	Fix #PSCSX-1684, display correct date format
-2014-03-21 10:55:15 +0100	Initial commit

From 1bede3345df5f0e261ab2014b7f7352ac1530b65 Mon Sep 17 00:00:00 2001
From: idnovate <info@idnovate.com>
Date: Mon, 14 Mar 2022 22:16:52 +0100
Subject: [PATCH 02/25] Fix hookFilterProductContent to allow hook chain

---
 productcomments.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/productcomments.php b/productcomments.php
index b3069ee0..ab163d47 100644
--- a/productcomments.php
+++ b/productcomments.php
@@ -930,7 +930,7 @@ public function hookDisplayFooterProduct($params)
     public function hookFilterProductContent(array $params)
     {
         if (empty($params['object']->id)) {
-            return;
+            return $params;
         }
         /** @var ProductCommentRepository $productCommentRepository */
         $productCommentRepository = $this->context->controller->getContainer()->get('product_comment_repository');
@@ -943,6 +943,8 @@ public function hookFilterProductContent(array $params)
             'averageRating' => $averageRating,
             'nbComments' => $nbComments,
         ];
+	    
+        return $params;
     }
 
     /**

From 5f825903c7a7e209feab38fed30e04dd44f1cf81 Mon Sep 17 00:00:00 2001
From: idnovate <info@idnovate.com>
Date: Thu, 17 Mar 2022 11:27:15 +0100
Subject: [PATCH 03/25] Update productcomments.php

---
 productcomments.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/productcomments.php b/productcomments.php
index ab163d47..4ec79b84 100644
--- a/productcomments.php
+++ b/productcomments.php
@@ -925,7 +925,7 @@ public function hookDisplayFooterProduct($params)
      *
      * @param array $params
      *
-     * @return void
+     * @return array
      */
     public function hookFilterProductContent(array $params)
     {

From 379da0f59b098fff037afcebb894da58e381c866 Mon Sep 17 00:00:00 2001
From: Krystian Podemski <kpodemski@users.noreply.github.com>
Date: Thu, 17 Mar 2022 11:53:50 +0100
Subject: [PATCH 04/25] Update productcomments.php

---
 productcomments.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/productcomments.php b/productcomments.php
index 4ec79b84..d345764c 100644
--- a/productcomments.php
+++ b/productcomments.php
@@ -943,7 +943,6 @@ public function hookFilterProductContent(array $params)
             'averageRating' => $averageRating,
             'nbComments' => $nbComments,
         ];
-	    
         return $params;
     }
 

From 43bef1733480e995b570e6fe4bbeeac0eb83a9f9 Mon Sep 17 00:00:00 2001
From: Krystian Podemski <kpodemski@users.noreply.github.com>
Date: Thu, 17 Mar 2022 11:55:57 +0100
Subject: [PATCH 05/25] Update productcomments.php

---
 productcomments.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/productcomments.php b/productcomments.php
index d345764c..6964b602 100644
--- a/productcomments.php
+++ b/productcomments.php
@@ -943,6 +943,7 @@ public function hookFilterProductContent(array $params)
             'averageRating' => $averageRating,
             'nbComments' => $nbComments,
         ];
+
         return $params;
     }
 

From 76b15dd9fa881c738cca8f2af781f5e2e076031b Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Tue, 21 Jun 2022 09:43:06 +0700
Subject: [PATCH 06/25] Remove unused ProductCriterion.php

ProductCriterion.php is not used anywhere.
---
 tests/phpstan/phpstan.neon | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon
index 3c61edce..d932a938 100644
--- a/tests/phpstan/phpstan.neon
+++ b/tests/phpstan/phpstan.neon
@@ -5,8 +5,7 @@ parameters:
     # From PHPStan 0.12, paths to check are relative to the neon file
     - ../../productcomments.php
     - ../../ProductComment.php
-    - ../../ProductCommentCriterion.php
-    - ../../ProductCriterion.php
+    - ../../ProductCommentCriterion.php    
     - ../../controllers/
     - ../../src/
     - ../../upgrade/

From 53f458923207104e0139e0a6d261e85aa9c0e8ef Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Tue, 21 Jun 2022 09:56:43 +0700
Subject: [PATCH 07/25] Delete ProductCriterion.php

---
 ProductCriterion.php | 192 -------------------------------------------
 1 file changed, 192 deletions(-)
 delete mode 100644 ProductCriterion.php

diff --git a/ProductCriterion.php b/ProductCriterion.php
deleted file mode 100644
index f9ce4f69..00000000
--- a/ProductCriterion.php
+++ /dev/null
@@ -1,192 +0,0 @@
-<?php
-/**
- * Copyright since 2007 PrestaShop SA and Contributors
- * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
- * that is bundled with this package in the file LICENSE.md.
- * It is also available through the world-wide-web at this URL:
- * https://opensource.org/licenses/AFL-3.0
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@prestashop.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
- * versions in the future. If you wish to customize PrestaShop for your
- * needs please refer to https://devdocs.prestashop.com/ for more information.
- *
- * @author    PrestaShop SA and Contributors <contact@prestashop.com>
- * @copyright Since 2007 PrestaShop SA and Contributors
- * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
- */
-class ProductCommentCriterion
-{
-    /**
-     * Add a Comment Criterion
-     *
-     * @return bool succeed
-     */
-    public static function add($id_lang, $name)
-    {
-        if (!Validate::isUnsignedId($id_lang) ||
-            !Validate::isMessage($name)) {
-            exit(Tools::displayError());
-        }
-
-        return Db::getInstance()->execute('
-		INSERT INTO `' . _DB_PREFIX_ . 'product_comment_criterion`
-		(`id_lang`, `name`) VALUES(
-		' . (int) ($id_lang) . ',
-		\'' . pSQL($name) . '\')');
-    }
-
-    /**
-     * Link a Comment Criterion to a product
-     *
-     * @return bool succeed
-     */
-    public static function addToProduct($id_product_comment_criterion, $id_product)
-    {
-        if (!Validate::isUnsignedId($id_product_comment_criterion) ||
-            !Validate::isUnsignedId($id_product)) {
-            exit(Tools::displayError());
-        }
-
-        return Db::getInstance()->execute('
-		INSERT INTO `' . _DB_PREFIX_ . 'product_comment_criterion_product`
-		(`id_product_comment_criterion`, `id_product`) VALUES(
-		' . (int) ($id_product_comment_criterion) . ',
-		' . (int) ($id_product) . ')');
-    }
-
-    /**
-     * Add grade to a criterion
-     *
-     * @return bool succeed
-     */
-    public static function addGrade($id_product_comment, $id_product_comment_criterion, $grade)
-    {
-        if (!Validate::isUnsignedId($id_product_comment) ||
-            !Validate::isUnsignedId($id_product_comment_criterion)) {
-            exit(Tools::displayError());
-        }
-        if ($grade < 0) {
-            $grade = 0;
-        } elseif ($grade > 10) {
-            $grade = 10;
-        }
-
-        return Db::getInstance()->execute('
-		INSERT INTO `' . _DB_PREFIX_ . 'product_comment_grade`
-		(`id_product_comment`, `id_product_comment_criterion`, `grade`) VALUES(
-		' . (int) ($id_product_comment) . ',
-		' . (int) ($id_product_comment_criterion) . ',
-		' . (int) ($grade) . ')');
-    }
-
-    /**
-     * Update criterion
-     *
-     * @return bool succeed
-     */
-    public static function update($id_product_comment_criterion, $id_lang, $name)
-    {
-        if (!Validate::isUnsignedId($id_product_comment_criterion) ||
-            !Validate::isUnsignedId($id_lang) ||
-            !Validate::isMessage($name)) {
-            exit(Tools::displayError());
-        }
-
-        return Db::getInstance()->execute('
-		UPDATE `' . _DB_PREFIX_ . 'product_comment_criterion` SET
-		`name` = \'' . pSQL($name) . '\'
-		WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion) . ' AND
-		`id_lang` = ' . (int) ($id_lang));
-    }
-
-    /**
-     * Get criterion by Product
-     *
-     * @return array Criterion
-     */
-    public static function getByProduct($id_product, $id_lang)
-    {
-        if (!Validate::isUnsignedId($id_product) ||
-            !Validate::isUnsignedId($id_lang)) {
-            exit(Tools::displayError());
-        }
-
-        return Db::getInstance()->executeS('
-		SELECT pcc.`id_product_comment_criterion`, pcc.`name`
-		FROM `' . _DB_PREFIX_ . 'product_comment_criterion` pcc
-		INNER JOIN `' . _DB_PREFIX_ . 'product_comment_criterion_product` pccp ON pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion`
-		WHERE pccp.`id_product` = ' . (int) ($id_product) . ' AND 
-		pcc.`id_lang` = ' . (int) ($id_lang));
-    }
-
-    /**
-     * Get Criterions
-     *
-     * @return array Criterions
-     */
-    public static function get($id_lang)
-    {
-        if (!Validate::isUnsignedId($id_lang)) {
-            exit(Tools::displayError());
-        }
-
-        return Db::getInstance()->executeS('
-		SELECT pcc.`id_product_comment_criterion`, pcc.`name`
-		  FROM `' . _DB_PREFIX_ . 'product_comment_criterion` pcc
-		WHERE pcc.`id_lang` = ' . (int) ($id_lang) . '
-		ORDER BY pcc.`name` ASC');
-    }
-
-    /**
-     * Delete product criterion by product
-     *
-     * @return bool succeed
-     */
-    public static function deleteByProduct($id_product)
-    {
-        if (!Validate::isUnsignedId($id_product)) {
-            exit(Tools::displayError());
-        }
-
-        return Db::getInstance()->execute('
-		DELETE FROM `' . _DB_PREFIX_ . 'product_comment_criterion_product`
-		WHERE `id_product` = ' . (int) ($id_product));
-    }
-
-    /**
-     * Delete all reference of a criterion
-     *
-     * @return bool succeed
-     */
-    public static function delete($id_product_comment_criterion)
-    {
-        if (!Validate::isUnsignedId($id_product_comment_criterion)) {
-            exit(Tools::displayError());
-        }
-        $result = Db::getInstance()->execute('
-		DELETE FROM `' . _DB_PREFIX_ . 'product_comment_grade`
-		WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion));
-        if ($result === false) {
-            return $result;
-        }
-        $result = Db::getInstance()->execute('
-		DELETE FROM `' . _DB_PREFIX_ . 'product_comment_criterion_product`
-		WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion));
-        if ($result === false) {
-            return $result;
-        }
-
-        return Db::getInstance()->execute('
-		DELETE FROM `' . _DB_PREFIX_ . 'product_comment_criterion`
-		WHERE `id_product_comment_criterion` = ' . (int) ($id_product_comment_criterion));
-    }
-}

From 6577f2c122088fe5039b8cdd65d7f967b1429120 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Fri, 24 Jun 2022 22:08:27 +0700
Subject: [PATCH 08/25] Replace deprecated CHARSET utf8 in install.sql

deprecated CHARSET utf8 need to be replaced by utf8mb4
---
 install.sql | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/install.sql b/install.sql
index 53ee6cb6..bb775562 100644
--- a/install.sql
+++ b/install.sql
@@ -14,35 +14,35 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment` (
   KEY `id_product` (`id_product`),
   KEY `id_customer` (`id_customer`),
   KEY `id_guest` (`id_guest`)
-) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion` (
   `id_product_comment_criterion` int(10) unsigned NOT NULL auto_increment,
   `id_product_comment_criterion_type` tinyint(1) NOT NULL,
   `active` tinyint(1) NOT NULL,
   PRIMARY KEY (`id_product_comment_criterion`)
-) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_product` (
   `id_product` int(10) unsigned NOT NULL,
   `id_product_comment_criterion` int(10) unsigned NOT NULL,
   PRIMARY KEY(`id_product`, `id_product_comment_criterion`),
   KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_lang` (
   `id_product_comment_criterion` INT(11) UNSIGNED NOT NULL ,
   `id_lang` INT(11) UNSIGNED NOT NULL ,
   `name` VARCHAR(64) NOT NULL ,
   PRIMARY KEY ( `id_product_comment_criterion` , `id_lang` )
-) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_category` (
   `id_product_comment_criterion` int(10) unsigned NOT NULL,
   `id_category` int(10) unsigned NOT NULL,
   PRIMARY KEY(`id_product_comment_criterion`, `id_category`),
   KEY `id_category` (`id_category`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` (
   `id_product_comment` int(10) unsigned NOT NULL,
@@ -50,20 +50,20 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` (
   `grade` int(10) unsigned NOT NULL,
   PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`),
   KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_usefulness` (
   `id_product_comment` int(10) unsigned NOT NULL,
   `id_customer` int(10) unsigned NOT NULL,
   `usefulness` tinyint(1) unsigned NOT NULL,
   PRIMARY KEY (`id_product_comment`, `id_customer`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_report` (
   `id_product_comment` int(10) unsigned NOT NULL,
   `id_customer` int(10) unsigned NOT NULL,
   PRIMARY KEY (`id_product_comment`, `id_customer`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
 
 INSERT IGNORE INTO `PREFIX_product_comment_criterion` VALUES ('1', '1', '1');
 

From b763630e063d3b8f2e62b6cd8d9ce1d2efb11d53 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:36:28 +0700
Subject: [PATCH 09/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index bb775562..e3119f90 100644
--- a/install.sql
+++ b/install.sql
@@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment` (
   KEY `id_product` (`id_product`),
   KEY `id_customer` (`id_customer`),
   KEY `id_guest` (`id_guest`)
-) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion` (
   `id_product_comment_criterion` int(10) unsigned NOT NULL auto_increment,

From be055594c00a4c348e416b8dcb68e4406881dc94 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:36:35 +0700
Subject: [PATCH 10/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index e3119f90..5371a441 100644
--- a/install.sql
+++ b/install.sql
@@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_product` (
   `id_product_comment_criterion` int(10) unsigned NOT NULL,
   PRIMARY KEY(`id_product`, `id_product_comment_criterion`),
   KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_lang` (
   `id_product_comment_criterion` INT(11) UNSIGNED NOT NULL ,

From 0a3c4474c9bf4ad73362166c852cec4a3f065085 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:36:55 +0700
Subject: [PATCH 11/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index 5371a441..43bfc1b7 100644
--- a/install.sql
+++ b/install.sql
@@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_category` (
   `id_category` int(10) unsigned NOT NULL,
   PRIMARY KEY(`id_product_comment_criterion`, `id_category`),
   KEY `id_category` (`id_category`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` (
   `id_product_comment` int(10) unsigned NOT NULL,

From 09df320203cee6e3a01a4be5d1c6f1013338607d Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:37:21 +0700
Subject: [PATCH 12/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index 43bfc1b7..4017fe5f 100644
--- a/install.sql
+++ b/install.sql
@@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion` (
   `id_product_comment_criterion_type` tinyint(1) NOT NULL,
   `active` tinyint(1) NOT NULL,
   PRIMARY KEY (`id_product_comment_criterion`)
-) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_product` (
   `id_product` int(10) unsigned NOT NULL,

From 5ef856a25b47787b3918091cca09d3a806eb195a Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:39:55 +0700
Subject: [PATCH 13/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index 4017fe5f..981cd0d9 100644
--- a/install.sql
+++ b/install.sql
@@ -50,7 +50,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_grade` (
   `grade` int(10) unsigned NOT NULL,
   PRIMARY KEY (`id_product_comment`, `id_product_comment_criterion`),
   KEY `id_product_comment_criterion` (`id_product_comment_criterion`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_usefulness` (
   `id_product_comment` int(10) unsigned NOT NULL,

From a23f7addd80501a8f83f298d89f0c90982c7e926 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:40:03 +0700
Subject: [PATCH 14/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index 981cd0d9..ae26cd74 100644
--- a/install.sql
+++ b/install.sql
@@ -57,7 +57,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_usefulness` (
   `id_customer` int(10) unsigned NOT NULL,
   `usefulness` tinyint(1) unsigned NOT NULL,
   PRIMARY KEY (`id_product_comment`, `id_customer`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_report` (
   `id_product_comment` int(10) unsigned NOT NULL,

From 907df5cdd7cf91124939078ce42dd7215bd9aca0 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 07:40:09 +0700
Subject: [PATCH 15/25] Update install.sql

Co-authored-by: Krystian Podemski <kpodemski@users.noreply.github.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index ae26cd74..a55bbec3 100644
--- a/install.sql
+++ b/install.sql
@@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_report` (
   `id_product_comment` int(10) unsigned NOT NULL,
   `id_customer` int(10) unsigned NOT NULL,
   PRIMARY KEY (`id_product_comment`, `id_customer`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
 
 INSERT IGNORE INTO `PREFIX_product_comment_criterion` VALUES ('1', '1', '1');
 

From 1459919bf1cb9642ff13cfc001cda80ab640336a Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 14:28:44 +0700
Subject: [PATCH 16/25] Update tests/phpstan/phpstan.neon

Co-authored-by: Thomas Roux <contact@okom3pom.com>
---
 tests/phpstan/phpstan.neon | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon
index d932a938..037652f7 100644
--- a/tests/phpstan/phpstan.neon
+++ b/tests/phpstan/phpstan.neon
@@ -5,7 +5,7 @@ parameters:
     # From PHPStan 0.12, paths to check are relative to the neon file
     - ../../productcomments.php
     - ../../ProductComment.php
-    - ../../ProductCommentCriterion.php    
+    - ../../ProductCommentCriterion.php
     - ../../controllers/
     - ../../src/
     - ../../upgrade/

From 329cd75ce275c6a7097a17fc17aeb08f0cf85f0d Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Sun, 26 Jun 2022 14:28:54 +0700
Subject: [PATCH 17/25] Update install.sql

Co-authored-by: Thomas Roux <contact@okom3pom.com>
---
 install.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sql b/install.sql
index a55bbec3..53ee6cb6 100644
--- a/install.sql
+++ b/install.sql
@@ -35,7 +35,7 @@ CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_lang` (
   `id_lang` INT(11) UNSIGNED NOT NULL ,
   `name` VARCHAR(64) NOT NULL ,
   PRIMARY KEY ( `id_product_comment_criterion` , `id_lang` )
-) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8mb4;
+) ENGINE=ENGINE_TYPE  DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS `PREFIX_product_comment_criterion_category` (
   `id_product_comment_criterion` int(10) unsigned NOT NULL,

From c16c01720df153090995ac853b29acf4138565d0 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Fri, 1 Jul 2022 07:54:22 +0700
Subject: [PATCH 18/25] Fix rating is not displayed the second Quick view

QuickView modal is called from a Product List context that already has productcomments.js loaded with
const $ = jQuery;
So we do not need this command in quickview.tpl.
Furthermore, this command creates SyntaxError: redeclaration of const $ that breaks the second quickview.
---
 views/templates/hook/product-additional-info-quickview.tpl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/views/templates/hook/product-additional-info-quickview.tpl b/views/templates/hook/product-additional-info-quickview.tpl
index 3d7c120a..6815cc6b 100644
--- a/views/templates/hook/product-additional-info-quickview.tpl
+++ b/views/templates/hook/product-additional-info-quickview.tpl
@@ -24,8 +24,7 @@
  *}
 
 {if $nb_comments != 0}
-  <script type="text/javascript">
-    const $ = jQuery;
+  <script type="text/javascript">    
     $('#product-quickview-{$product.id}').insertAfter($('.quickview #product-description-short'));
     $('#product-quickview-{$product.id} .grade-stars').rating({ grade: {$average_grade} });
     $('#product-quickview-{$product.id} .comments-nb').html('({$nb_comments})');

From ddc6fef20e45ae0f7eec8e1b8c90377e63b67b94 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Mon, 4 Jul 2022 16:02:36 +0700
Subject: [PATCH 19/25] Fix jQuery shorthand deprecated - change n submit

---
 views/js/post-comment.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/views/js/post-comment.js b/views/js/post-comment.js
index 5e8ce02e..3601f882 100644
--- a/views/js/post-comment.js
+++ b/views/js/post-comment.js
@@ -65,7 +65,7 @@ jQuery(document).ready(function () {
     $('#post-product-comment-form input[type="text"]').removeClass('valid error');
     $('#post-product-comment-form textarea').val('');
     $('#post-product-comment-form textarea').removeClass('valid error');
-    $('#post-product-comment-form .criterion-rating input').val(3).change();
+    $('#post-product-comment-form .criterion-rating input').val(3).trigger('change');
   }
 
   function initCommentModal() {
@@ -75,7 +75,7 @@ jQuery(document).ready(function () {
       showPostCommentModal();
     });
 
-    $('#post-product-comment-form').submit(submitCommentForm);
+    $('#post-product-comment-form').on('submit', submitCommentForm);
   }
 
   function submitCommentForm(event) {

From 27cb3472bf314171ad378dc73e0ce92c1ebd6fa3 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Mon, 4 Jul 2022 16:12:30 +0700
Subject: [PATCH 20/25] Fix jQuery shorthand deprecated - change n hover

---
 views/js/jquery.rating.plugin.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/views/js/jquery.rating.plugin.js b/views/js/jquery.rating.plugin.js
index 0745cb8e..0fa090da 100644
--- a/views/js/jquery.rating.plugin.js
+++ b/views/js/jquery.rating.plugin.js
@@ -67,7 +67,7 @@ jQuery.fn.rating = function(generalOptions) {
       ratingInput = $('<input type="number" name="'+componentOptions.input+'" id="'+componentOptions.input+'" />');
       ratingInput.val(ratingValue);
       ratingInput.css('display', 'none');
-      ratingInput.change(displayInteractiveGrade);
+      ratingInput.on('change', displayInteractiveGrade);
       $ratingComponent.append(ratingInput);
       initInteractiveGrade();
     } else {
@@ -81,7 +81,7 @@ jQuery.fn.rating = function(generalOptions) {
       for (var i = minValue; i <= maxValue; ++i) {
         newStar = emptyStar.clone();
         newStar.data('grade', i);
-        newStar.hover(function overStar() {
+        newStar.on('mouseenter mouseleave', function overStar() {
           var overIndex = $('.star', fullStars).index($(this));
           $('.star', fullStars).each(function overStars() {
             $(this).removeClass('star-on');
@@ -100,7 +100,7 @@ jQuery.fn.rating = function(generalOptions) {
         fullStars.append(newStar);
       }
 
-      fullStars.hover(function(){}, displayInteractiveGrade);
+      fullStars.mouseenter(function(){}).mouseleave(displayInteractiveGrade);
       displayInteractiveGrade();
     }
 

From fdf0cb96b6f1e6dcd88ab6d5bd58a572b7318ba1 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Wed, 6 Jul 2022 07:30:26 +0700
Subject: [PATCH 21/25] Fix jQuery shorthand deprecated - click

---
 views/js/jquery.rating.plugin.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/js/jquery.rating.plugin.js b/views/js/jquery.rating.plugin.js
index 0fa090da..d23b45b7 100644
--- a/views/js/jquery.rating.plugin.js
+++ b/views/js/jquery.rating.plugin.js
@@ -93,7 +93,7 @@ jQuery.fn.rating = function(generalOptions) {
             }
           });
         });
-        newStar.click(function selectGrade() {
+        newStar.on('click', function selectGrade() {
           var selectedGrade = $(this).data('grade');
           ratingInput.val(selectedGrade);
         });

From a2db9daf4b4ade9212082a199659d9aedb628b65 Mon Sep 17 00:00:00 2001
From: leemyongpakvn <leemyongpakvn@gmail.com>
Date: Thu, 21 Jul 2022 14:20:57 +0700
Subject: [PATCH 22/25] mouseenter and mouseleave shorthand are deprecated

too
---
 views/js/jquery.rating.plugin.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/views/js/jquery.rating.plugin.js b/views/js/jquery.rating.plugin.js
index d23b45b7..b466e9fd 100644
--- a/views/js/jquery.rating.plugin.js
+++ b/views/js/jquery.rating.plugin.js
@@ -100,7 +100,7 @@ jQuery.fn.rating = function(generalOptions) {
         fullStars.append(newStar);
       }
 
-      fullStars.mouseenter(function(){}).mouseleave(displayInteractiveGrade);
+      fullStars.on('mouseenter', function(){}).on('mouseleave', displayInteractiveGrade);
       displayInteractiveGrade();
     }
 

From 2b57977bc4acaca2be6c959432c373b8dd795bc1 Mon Sep 17 00:00:00 2001
From: Thomas BACCELLI <thomas.baccelli@prestashop.com>
Date: Thu, 4 Aug 2022 20:49:43 +0200
Subject: [PATCH 23/25] Escape username

---
 productcomments.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/productcomments.php b/productcomments.php
index b3069ee0..41065089 100644
--- a/productcomments.php
+++ b/productcomments.php
@@ -677,6 +677,7 @@ public function getStandardFieldList()
      */
     public function renderAuthorName($value, $row)
     {
+        $value = htmlentities($value);
         if (!empty($row['customer_id'])) {
             $linkToCustomerProfile = $this->context->link->getAdminLink('AdminCustomers', false, [], [
                 'id_customer' => $row['customer_id'],

From a871ac6add5c64768e6ab04f51006501db0843bf Mon Sep 17 00:00:00 2001
From: Mathieu Ferment <mathieu.ferment@prestashop.com>
Date: Tue, 16 Aug 2022 17:00:25 +0200
Subject: [PATCH 24/25] Update config.xml version to 5.0.2

---
 config.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.xml b/config.xml
index 7a131fdc..ba573009 100644
--- a/config.xml
+++ b/config.xml
@@ -2,7 +2,7 @@
 <module>
     <name>productcomments</name>
     <displayName><![CDATA[Product Comments]]></displayName>
-    <version><![CDATA[5.0.1]]></version>
+    <version><![CDATA[5.0.2]]></version>
     <description><![CDATA[Allows users to post reviews and rate products on specific criteria.]]></description>
     <author><![CDATA[PrestaShop]]></author>
     <tab><![CDATA[front_office_features]]></tab>

From 7a03fd07b4d32016dccb6207350acb5da97257d0 Mon Sep 17 00:00:00 2001
From: Mathieu Ferment <mathieu.ferment@prestashop.com>
Date: Tue, 16 Aug 2022 17:00:36 +0200
Subject: [PATCH 25/25] Update version to 5.0.2

---
 productcomments.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/productcomments.php b/productcomments.php
index 6964b602..2c608a3d 100644
--- a/productcomments.php
+++ b/productcomments.php
@@ -45,7 +45,7 @@ public function __construct()
     {
         $this->name = 'productcomments';
         $this->tab = 'front_office_features';
-        $this->version = '5.0.1';
+        $this->version = '5.0.2';
         $this->author = 'PrestaShop';
         $this->need_instance = 0;
         $this->bootstrap = true;