Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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[9.0.0]]></version>
<version><![CDATA[9.0.1]]></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
3 changes: 2 additions & 1 deletion productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ public function __construct()
{
$this->name = 'productcomments';
$this->tab = 'front_office_features';
$this->version = '9.0.0';
$this->version = '9.0.1';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
$this->module_key = 'e699ddd0ac2d61593ec594e82b719da6';

parent::__construct();

Expand Down
9 changes: 7 additions & 2 deletions src/Repository/ProductCommentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ public function delete(ProductComment $entity): void
{
$entityId = $entity->getId();

$this->remove($entity, true);

// The rows below reference the comment, so they have to go first. Without the foreign keys the
// order does not matter, but a shop that applied the schema this module declares does have them,
// and removing the comment first fails with "Cannot delete or update a parent row".
$this->deleteGrades($entityId);
$this->deleteReports($entityId);
$this->deleteUsefulness($entityId);

$this->remove($entity, true);
}

/**
Expand Down Expand Up @@ -302,6 +305,7 @@ public function getAverageGrades(array $productIds, $validatedOnly)
$sql = 'SELECT';

$count = count($productIds);
$productIds = array_values($productIds);

foreach ($productIds as $index => $id) {
$esqID = (int) $id;
Expand Down Expand Up @@ -367,6 +371,7 @@ public function getCommentsNumberForProducts(array $productIds, $validatedOnly)
$sql = 'SELECT';

$count = count($productIds);
$productIds = array_values($productIds);

foreach ($productIds as $index => $id) {
$esqID = (int) $id;
Expand Down
2 changes: 2 additions & 0 deletions views/js/list-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jQuery(document).ready(function () {
const nextCount = totalPages + 1;
const gapText = '&hellip;';

$('#product-comments-list-header .grade-stars').rating();
$('#product-comments-list .grade-stars').rating();
$('.product-comments-additional-info .grade-stars').rating();

Expand All @@ -47,6 +48,7 @@ jQuery(document).ready(function () {
})

document.addEventListener('updateRating', function() {
$('#product-comments-list-header .grade-stars').rating();
$('#product-comments-list .grade-stars').rating();
$('.product-comments-additional-info .grade-stars').rating();
});
Expand Down
Loading