Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fd4f409
Update list-comments.js
djbuch May 25, 2023
5ee20b6
Update css modal
pawelkierklo May 2, 2024
0d1b99f
remove deprecated since v4.0.0 functions
leemyongpakva May 7, 2024
45d1fba
CS fix
leemyongpakva May 7, 2024
11a89d7
update github actions from v3 to v4
leemyongpakva May 11, 2024
3b8119f
Merge pull request #207 from leemyongpakva/remove_deprecated_since_4.…
kpodemski May 15, 2024
59be87a
Merge pull request #208 from leemyongpakva/github_action_v4
kpodemski May 15, 2024
8c45500
fix: update product listing ratings on updateProduct event
tblivet May 31, 2024
b93d8bf
Merge pull request #211 from tblivet/bugfix/product-listing-update-ra…
nicosomb Jun 13, 2024
574ce37
fix: template loading on product update
tblivet Jun 24, 2024
fe56da8
fix: quickview note update
tblivet Jun 24, 2024
3a68c46
Merge pull request #206 from pawelkierklo/dev
tblivet Jun 27, 2024
c093968
Merge pull request #212 from tblivet/fix/update_quickview_note
tblivet Jun 27, 2024
ac3939f
Fix productcomments when not logged
CedricKiwik Oct 28, 2024
670802a
Merge pull request #213 from CedricKiwik/pr_customer
nicosomb May 22, 2025
2fc90d6
Add Sponsors Compagny
Touxten Jun 18, 2025
943d264
Merge pull request #214 from Touxten/Touxten-patch-1
jolelievre Jun 18, 2025
8041a3a
Provide absolute URL
Hlavtox Jul 25, 2025
2fd6638
Update productcomments.php
Hlavtox Oct 29, 2025
902e2fa
Update productcomments.php
Hlavtox Oct 29, 2025
7ed9f9e
Update productcomments.php
Hlavtox Oct 31, 2025
fef6511
release: bump to version 8.0.0
ga-devfront Oct 31, 2025
1e279ed
release: remove deprecated
ga-devfront Oct 31, 2025
44dbc13
Merge pull request #219 from ga-devfront/release/bump-to-8-0-0
Hlavtox Oct 31, 2025
ee9a2d9
Merge pull request #220 from ga-devfront/release/remove-dreprecated
ga-devfront Oct 31, 2025
68cdac5
Merge pull request #163 from djbuch/patch-1
ga-devfront Oct 31, 2025
3a134d9
Merge pull request #216 from Hlavtox/provide-absolute-url
Hlavtox Oct 31, 2025
bd1fbe4
Update ListComments.php
mjamroz Jun 21, 2023
e6dd36c
Run CS Fixer
Quetzacoalt91 Nov 3, 2025
8455fd8
Merge pull request #171 from mjamroz/patch-1
ga-devfront Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Check out our contribution guidelines to find out how to complete it:
https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/#pull-requests
------------------------------------------------------------------------------>

| Questions | Answers
| ------------- | -------------------------------------------------------
| Description? | Please be specific when describing the PR. <br> Every detail helps: versions, browser/server configuration, specific module/theme, etc. Feel free to add more information below this table.
| Type? | bug fix / improvement / new feature / refacto / critical
| BC breaks? | yes / no
| Deprecations? | yes / no
| Fixed ticket? | Fixes PrestaShop/Prestashop#{issue number here}.
| How to test? | Please indicate how to best verify that this PR is correct.
| Questions | Answers
| ----------------- | -------------------------------------------------------
| Description? | Please be specific when describing the PR. <br> Every detail helps: versions, browser/server configuration, specific module/theme, etc. Feel free to add more information below this table.
| Type? | bug fix / improvement / new feature / refacto / critical
| BC breaks? | yes / no
| Deprecations? | yes / no
| Fixed ticket? | Fixes PrestaShop/Prestashop#{issue number here}.
| How to test? | Please indicate how to best verify that this PR is correct.
| Sponsor company | Your company or customer's name goes here (if applicable).

<!-- Click the form's "Preview" button to make sure the table is functional in GitHub. Thank you! -->
6 changes: 3 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4
- name: Install composer dependencies
run: composer install --no-dev -o
- name: Clean-up project
Expand All @@ -17,7 +17,7 @@ jobs:
- name: Generate index.php
run: ~/.composer/vendor/bin/autoindex
- name: Create & upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: /home/runner/work/${{ github.event.repository.name }}
Expand All @@ -27,7 +27,7 @@ jobs:
if: github.event_name == 'push' && (github.event.ref == 'refs/heads/main' || github.event.ref == 'refs/heads/master')
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- name: PHP syntax checker 7.2
uses: prestashop/github-action-php-lint/7.2@master
Expand Down Expand Up @@ -38,10 +38,10 @@ jobs:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
Expand All @@ -66,18 +66,18 @@ jobs:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

# Add composer local folder in cache to make next builds faster
- name: Cache composer folder
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: php-composer-cache
Expand Down
100 changes: 0 additions & 100 deletions ProductComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,6 @@ public static function getRatings($id_product)
return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getRow($sql);
}

/**
* @deprecated 4.0.0
*/
public static function getAverageGrade($id_product)
{
$validate = Configuration::get('PRODUCT_COMMENTS_MODERATE');

return Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getRow('
SELECT AVG(pc.`grade`) AS grade
FROM `' . _DB_PREFIX_ . 'product_comment` pc
WHERE pc.`id_product` = ' . (int) $id_product . '
AND pc.`deleted` = 0' .
($validate == '1' ? ' AND pc.`validate` = 1' : ''));
}

public static function getAveragesByProduct($id_product, $id_lang)
{
/* Get all grades */
Expand Down Expand Up @@ -234,31 +219,6 @@ public static function getAveragesByProduct($id_product, $id_lang)
return $averages;
}

/**
* Return number of comments and average grade by products
*
* @return int|false
*
* @deprecated 4.0.0
*/
public static function getCommentNumber($id_product)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$validate = (bool) Configuration::get('PRODUCT_COMMENTS_MODERATE');
$cache_id = 'ProductComment::getCommentNumber_' . $id_product . '-' . $validate;
if (!Cache::isStored($cache_id)) {
$result = (int) Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(`id_product_comment`) AS "nbr"
FROM `' . _DB_PREFIX_ . 'product_comment` pc
WHERE `id_product` = ' . $id_product . ($validate ? ' AND `validate` = 1' : ''));
Cache::store($cache_id, (string) $result);
}

return (int) Cache::retrieve($cache_id);
}

/**
* Return number of comments and average grade by products
*
Expand Down Expand Up @@ -434,66 +394,6 @@ public static function deleteUsefulness($id_product_comment)
WHERE `id_product_comment` = ' . $id_product_comment);
}

/**
* Report comment
*
* @return bool
*
* @deprecated 4.0.0 - migrated to controllers/front/ReportComment and src/Entity/ProductCommentReport
*/
public static function reportComment($id_product_comment, $id_customer)
{
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_report` (`id_product_comment`, `id_customer`)
VALUES (' . (int) $id_product_comment . ', ' . (int) $id_customer . ')');
}

/**
* Comment already report
*
* @return bool
*
* @deprecated 4.0.0 - migrated to controllers/front/ReportComment and src/Entity/ProductCommentReport
*/
public static function isAlreadyReport($id_product_comment, $id_customer)
{
return (bool) Db::getInstance()->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'product_comment_report`
WHERE `id_customer` = ' . (int) $id_customer . '
AND `id_product_comment` = ' . (int) $id_product_comment);
}

/**
* Set comment usefulness
*
* @return bool
*
* @deprecated 4.0.0 - migrated to controllers/front/UpdateCommentUsefulness and src/Entity/ProductCommentUsefulness
*/
public static function setCommentUsefulness($id_product_comment, $usefulness, $id_customer)
{
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'product_comment_usefulness` (`id_product_comment`, `usefulness`, `id_customer`)
VALUES (' . (int) $id_product_comment . ', ' . (int) $usefulness . ', ' . (int) $id_customer . ')');
}

/**
* Usefulness already set
*
* @return bool
*
* @deprecated 4.0.0 - migrated to controllers/front/UpdateCommentUsefulness and src/Entity/ProductCommentUsefulness
*/
public static function isAlreadyUsefulness($id_product_comment, $id_customer)
{
return (bool) Db::getInstance()->getValue('
SELECT COUNT(*)
FROM `' . _DB_PREFIX_ . 'product_comment_usefulness`
WHERE `id_customer` = ' . (int) $id_customer . '
AND `id_product_comment` = ' . (int) $id_product_comment);
}

/**
* Get reported comments
*
Expand Down
68 changes: 0 additions & 68 deletions ProductCommentCriterion.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,74 +133,6 @@ public function addCategory($id_category)
');
}

/**
* Add grade to a criterion
*
* @return bool succeed
*
* @deprecated 4.0.0
*/
public function addGrade($id_product_comment, $grade)
{
if (!Validate::isUnsignedId($id_product_comment)) {
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(
' . $id_product_comment . ',
' . (int) $this->id . ',
' . (int) ($grade) . ')');
}

/**
* Get criterion by Product
*
* @return array Criterion
*
* @deprecated 4.0.0
*/
public static function getByProduct($id_product, $id_lang)
{
if (!Validate::isUnsignedId($id_product) ||
!Validate::isUnsignedId($id_lang)) {
exit(Tools::displayError());
}

$cache_id = 'ProductCommentCriterion::getByProduct_' . $id_product . '-' . $id_lang;
if (!Cache::isStored($cache_id)) {
$result = Db::getInstance()->executeS('
SELECT pcc.`id_product_comment_criterion`, pccl.`name`
FROM `' . _DB_PREFIX_ . 'product_comment_criterion` pcc
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment_criterion_lang` pccl
ON (pcc.id_product_comment_criterion = pccl.id_product_comment_criterion)
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment_criterion_product` pccp
ON (pcc.`id_product_comment_criterion` = pccp.`id_product_comment_criterion` AND pccp.`id_product` = ' . $id_product . ')
LEFT JOIN `' . _DB_PREFIX_ . 'product_comment_criterion_category` pccc
ON (pcc.`id_product_comment_criterion` = pccc.`id_product_comment_criterion`)
LEFT JOIN `' . _DB_PREFIX_ . 'product_shop` ps
ON (ps.id_category_default = pccc.id_category AND ps.id_product = ' . $id_product . ')
WHERE pccl.`id_lang` = ' . $id_lang . '
AND (
pccp.id_product IS NOT NULL
OR ps.id_product IS NOT NULL
OR pcc.id_product_comment_criterion_type = 1
)
AND pcc.active = 1
GROUP BY pcc.id_product_comment_criterion
');
Cache::store($cache_id, $result);
}

return Cache::retrieve($cache_id);
}

/**
* Get Criterions
*
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>productcomments</name>
<displayName><![CDATA[Product Comments]]></displayName>
<version><![CDATA[7.0.0]]></version>
<version><![CDATA[8.0.0]]></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>
Expand Down
1 change: 1 addition & 0 deletions controllers/front/ListComments.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function display()

if ($isLastNameAnonymous) {
$productComment['customer_name'] = $this->anonymizeName($productComment['customer_name']);
$productComment['lastname'] = '...';
}

$productComment['customer_name'] = htmlentities($productComment['customer_name']);
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/PostComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ProductCommentsPostCommentModuleFrontController extends ModuleFrontControl
public function display()
{
header('Content-Type: application/json');
if (!(int) $this->context->cookie->id_customer && !Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS')) {
if (!$this->context->customer->isLogged() && !Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS')) {
$this->ajaxRender(
json_encode(
[
Expand Down
20 changes: 14 additions & 6 deletions productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct()
{
$this->name = 'productcomments';
$this->tab = 'front_office_features';
$this->version = '7.0.0';
$this->version = '8.0.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
Expand Down Expand Up @@ -455,7 +455,7 @@ public function renderModerateLists()
$helper->table = $this->name;
$helper->table_id = 'waiting-approval-productcomments-list';
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);
$helper->no_link = true;

$return .= $helper->generateList($comments, $fields_list);
Expand All @@ -480,7 +480,7 @@ public function renderModerateLists()
$helper->table = $this->name;
$helper->table_id = 'reported-productcomments-list';
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);
$helper->no_link = true;

$return .= $helper->generateList($comments, $fields_list);
Expand Down Expand Up @@ -564,7 +564,7 @@ public function renderCriterionList()
$helper->title = $this->trans('Review Criteria', [], 'Modules.Productcomments.Admin');
$helper->table = $this->name . 'criterion';
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);

return $helper->generateList($criterions, $fields_list);
}
Expand All @@ -585,7 +585,7 @@ public function renderCommentsList()
$helper->table = $this->name;
$helper->table_id = 'approved-productcomments-list';
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);
$helper->no_link = true;

$page = ($page = Tools::getValue('submitFilter' . $helper->list_id)) ? (int) $page : 1;
Expand Down Expand Up @@ -1076,11 +1076,19 @@ public function renderWidget($hookName = null, array $configuration = [])
case 'quickview':
$filePath = $tplHookPath . 'product-additional-info-quickview.tpl';
break;
case 'refresh':
if (Tools::getValue('quickview') == true) {
$filePath = '';
} else {
$filePath = $tplHookPath . 'product-additional-info.tpl';
}
break;
case '':
$filePath = $tplHookPath . 'product-additional-info.tpl';
break;
default: // 'refresh' and other unpredicted cases
default:
$filePath = '';
break;
}
}

Expand Down
Loading
Loading