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

Expose comments for theme #140

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Expose comments for theme #140

wants to merge 4 commits into from

Conversation

rodriciru
Copy link

@rodriciru rodriciru commented Jun 9, 2022

Questions Answers
Description? Expose comments for theme
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop/PrestaShop#28719
How to test? in theme should be a smarty var $product.productComments.comments with the reviews

Related PR and issues:
PrestaShop/hummingbird#319
PrestaShop/PrestaShop#28719

I try to do in theme files but google complains about it because we can't link the product schema whit the microdata or json+ld on .tpl (Really you can (@id or itemref) but it still complains because on product schema theres no direct ref to the reviews.
So the best option is add to the module

productcomments.php Outdated Show resolved Hide resolved
@NeOMakinG NeOMakinG requested a review from a team July 25, 2022 07:00
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.

Hello @rodriciru

Could you double-check if it is really needed to load the class? It really shouldn't be.

@rodriciru
Copy link
Author

rodriciru commented Dec 12, 2022 via email

@rodriciru
Copy link
Author

rodriciru commented Dec 13, 2022

imagen
imagen
Also, look at lines 253,413 and 559. The person who made this module, also includes this file...

Copy link
Contributor

@matks matks left a comment

Choose a reason for hiding this comment

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

As @rodriciru mentioned there are other require in this module so although it looks strange it seems this module needs manual loads.

CI is red but I re-run it

@rodriciru
Copy link
Author

rodriciru commented Mar 29, 2023

I move the include location to the top, so the hookFilterProductContent method can access ProductComment class.
This is because, as for my tests, when the hook is called the method getContent() (which is where the old require was) is not called (and for a good reason as I think is only for configure of the module)

For clarification, whitout move the include i get this:

[29-Mar-2023 16:32:26 Europe/Madrid] PHP Fatal error:  Uncaught Error: Class "ProductComment" not found in /usr/home/XXXXXXXXX/web/modules/productcomments/productcomments.php:943
Stack trace:
#0 /usr/home/XXXXXXXXX/web/classes/Hook.php(983): ProductComments->hookFilterProductContent(Array)
#1 /usr/home/XXXXXXXXX/web/classes/Hook.php(409): HookCore::coreCallHook(Object(ProductComments), 'hookFilterProdu...', Array)
#2 /usr/home/XXXXXXXXX/web/classes/Hook.php(918): HookCore::callHookOn(Object(ProductComments), 'filterProductCo...', Array)
#3 /usr/home/XXXXXXXXX/web/controllers/front/ProductController.php(390): HookCore::exec('filterProductCo...', Array, NULL, false, true, false, NULL, true)
#4 /usr/home/XXXXXXXXX/web/classes/controller/Controller.php(319): ProductControllerCore->initContent()
#5 /usr/home/XXXXXXXXX/web/classes/Dispatcher.php(510): ControllerCore->run()
#6 /usr/home/XXXXXXXXXs/web/index.php(28): DispatcherCore->dispatch()
#7 {main}
  thrown in /usr/home/XXXXXXXXX/web/modules/productcomments/productcomments.php on line 943

@rodriciru rodriciru requested review from atomiix, matks and kpodemski and removed request for atomiix, matks and kpodemski March 29, 2023 15:12
@rodriciru rodriciru deleted the branch PrestaShop:dev March 29, 2023 15:48
@rodriciru rodriciru closed this Mar 29, 2023
@rodriciru rodriciru deleted the dev branch March 29, 2023 15:48
@rodriciru rodriciru restored the dev branch March 29, 2023 15:49
@rodriciru rodriciru reopened this Mar 29, 2023
@aniszr
Copy link

aniszr commented Jun 26, 2023

Hello,

This PR should be tested with the PR "Add products reviews to schema.org " PrestaShop/hummingbird#319 which presents a branch conflict!

So this PR will be blocked until the other one will be waiting for QA.

Thanks!

@matks
Copy link
Contributor

matks commented Sep 12, 2023

I have asked if the PR is still blocked in PrestaShop/hummingbird#319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

Expose smarty var to add reviews on productcomments
7 participants