Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent MakeRatingMandatory feature breaks review in 3rd party theme #210

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion views/js/post-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jQuery(document).ready(function () {
const commentPostErrorModal = $('#product-comment-post-error');

const criterionsList = $('#criterions_list');
if (typeof productCommentMandatoryMessage === 'undefined')
productCommentMandatoryMessage = 'Please choose a rating for your review.';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be a translatable phrase.

Copy link
Contributor Author

@leemyongpakva leemyongpakva Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly it is, in this template file. This PR is a patch for hummingbird 0.2.0 or third-party themes that has their own override post-comment-modal.tpl - not implemented productcomment 7.0.0's new review-mandatory feature yet. In these cases, a non-technical shop-owner will just complain ''my client can not do review after upgrading productcomment to v7.0.0'' , then an English phrase is clearly better than a broken review.

criterionsList.append('<div id="ratingNotChosen">* ' + productCommentMandatoryMessage + '</div>');
const criterionsInfo = $('#ratingNotChosen');

Expand Down Expand Up @@ -128,7 +130,7 @@ jQuery(document).ready(function () {
$(fieldSelector).removeClass('error');
$(fieldSelector).addClass('valid');
}

if (!ratingChosen) {
criterionsInfo.show();
isValid = false;
Expand Down