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

Conversation

leemyongpakva
Copy link
Contributor

@leemyongpakva leemyongpakva commented May 28, 2024

Questions Answers
Description? Third party themes with override template for productcomments 7.0.0 will face bug when submitting review if the translation string for MakeRatingMandatory is not added in themes yet.
The issue was locally solved in hummingbird beta but still happens in hummingbird 0.2.0.
This PR solve the issue globally for all themes. If the shop owner want to use their own translation string then they must take care escape characters themselves ;)
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop/PrestaShop#36093
How to test? Test with productcomments 7.0.0 and hummingbird 0.2.0 on PS 1.7.8+.
Before PR you will see the issue as described in the above ticket, after PR the issue won't happen.

@@ -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.

Copy link
Contributor

@kpodemski kpodemski left a comment

Choose a reason for hiding this comment

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

The text you added has to be a translatable phrase.

@pawelkierklo
Copy link
Contributor

Please put this code to hook after line 7 on product-comments-list.tpl

var productCommentMandatoryMessage = '{l|escape:'javascript' s='Please choose a rating for your review.' d='Modules.Productcomments.Shop'}';
</script>

and please don't change file post-comment.js

@leemyongpakva
Copy link
Contributor Author

@pawelkierklo hummingbird theme has its own override product-comments-list.tpl, so putting productCommentMandatoryMessage declaration in module template file won't solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for review
4 participants