Skip to content

Commit

Permalink
Release 5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiix committed Aug 31, 2022
2 parents b2586be + 314456d commit e1b9d03
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 209 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.txt

This file was deleted.

192 changes: 0 additions & 192 deletions ProductCriterion.php

This file was deleted.

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[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>
Expand Down
9 changes: 6 additions & 3 deletions productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -925,12 +926,12 @@ public function hookDisplayFooterProduct($params)
*
* @param array $params
*
* @return void
* @return array
*/
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');
Expand All @@ -943,6 +944,8 @@ public function hookFilterProductContent(array $params)
'averageRating' => $averageRating,
'nbComments' => $nbComments,
];

return $params;
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ parameters:
- ../../productcomments.php
- ../../ProductComment.php
- ../../ProductCommentCriterion.php
- ../../ProductCriterion.php
- ../../controllers/
- ../../src/
- ../../upgrade/
Expand Down
8 changes: 4 additions & 4 deletions views/js/jquery.rating.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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');
Expand All @@ -93,14 +93,14 @@ jQuery.fn.rating = function(generalOptions) {
}
});
});
newStar.click(function selectGrade() {
newStar.on('click', function selectGrade() {
var selectedGrade = $(this).data('grade');
ratingInput.val(selectedGrade);
});
fullStars.append(newStar);
}

fullStars.hover(function(){}, displayInteractiveGrade);
fullStars.on('mouseenter', function(){}).on('mouseleave', displayInteractiveGrade);
displayInteractiveGrade();
}

Expand Down
4 changes: 2 additions & 2 deletions views/js/post-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions views/templates/hook/product-additional-info-quickview.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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})');
Expand Down

0 comments on commit e1b9d03

Please sign in to comment.