-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix productcomments when not logged #213
base: dev
Are you sure you want to change the base?
Conversation
CedricKiwik
commented
Oct 28, 2024
Questions | Answers |
---|---|
Description? | When a customer is not logged, it is possible to publish a review if the customer informations are in the cookie. We should check if the customer is logged or not with $this->context->customer->isLogged() instead of checking the cookie. |
Type? | bug fix |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | |
How to test? | Go to Back Office, configure module productcomments and disallow guest to post reviews. Go to Front Office and post a review in a product : if you are not logged a error message should display, if you are logged then the review is posted. |
Hello @CedricKiwik! This is your first pull request on productcomments repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
In usual procedures, you need to create an issue at PrestaShop/issues first. Once QA team confirmed the issue, you can fill it here into the Fixed ticket? section, then we can proceed the PR. |
@florine2623 This is a legit fix. I did not test it, but by looking at the code, I can see the issue. $context->cookie->id_customer will be filled also if you fill data in checkout as a guest, and that's not precise. 👍 Thanks @CedricKiwik 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @CedricKiwik ,
Could you show how to check the information of a logged-in customer or not in the cookie ?
In the traditional way of logging into your customer account, I can't reproduce the issue.
Screen.Recording.2024-10-29.at.15.17.37.mov
Waiting for your feedback :)
Thanks!
Hello @florine2623, However, when logging out using the logout button, there are no issues; the button to post reviews does not appear. Finally, upon looking at the code in controllers/front/PostComment.php line 37, we realize that we are using |