prestarocket-agence / classic-rocket

Classic Rocket is a rework of "classic theme". It has been built keeping in mind : performance, accessibility and SEO.
https://demoprestashop.prestarocket.com/
Other
229 stars 127 forks source link

error when debugging mode activated #221

Open etsmes opened 3 years ago

etsmes commented 3 years ago

Dears,

When I have debugging mode activated in my store, the product page does not work. The error that I attach comes out.

Prestashop 1.7.7.2 PHP 7.2

Kind regards,

Captura (1)
prestarocket commented 3 years ago

maybe duplicate with https://github.com/prestarocket-agence/classic-rocket/pull/220

etsmes commented 3 years ago

it may be, but what is the solution?

Thank you

prestarocket commented 3 years ago

you have to try solution given by @tswfi

etsmes commented 3 years ago

sorry

modifying the files list-comments-js and post-comments.js the error is still there

etsmes commented 3 years ago

Nobody knows a solution?

Regards!

tswfi commented 3 years ago

@etsmes I cannot replicate this on my test environment.

Your error seems to come from microdata-jsonld.tpl and implies that it tries to find a "mycomment" information from somewhere.

That file does not have anything related to "mycomment": https://github.com/prestarocket-agence/classic-rocket/blob/master/templates/_partials/microdata-jsonld.tpl

Actually the string "mycomment" does not appear anywhere in classic-rocket.

Double check your own changes and other modules that might affect this.

etsmes commented 3 years ago

Hi @tswfi,

Thanks for your reply. I think this bug is an issue between the Prestashop opinions and comments module and Rocket Theme. But I don’t know how to fix it.

Regards, Josep

tswfi commented 3 years ago

Tell me the steps on how to replicate this (preferably with the docker environment in this pr: https://github.com/prestarocket-agence/classic-rocket/pull/223 )

etsmes commented 3 years ago

Hi @tswfi,

Thank you for your answer.

I have a test server with the same error. Can I send you a private email with the BackOffice user, FTP, etc.? You can see my email in my profile.

I have installed the mypresta reviews module, but they tell me that the error does not come from the module.

Captura

Regards, Josep

tswfi commented 3 years ago

@etsmes nope, I don't touch other people servers :)

Please tell me the steps to replicate this on a clean installation and I can take a look in a dev environment.

etsmes commented 3 years ago

Okay. It's just a test server, but I get it. Thanks.

The steps:

1- Install the latest version of Prestashop, 1.7.7.2, 2- Install Rocket Theme 3- Install and activate Prestashop Free product reviews by MyPresta 4 - Set Prestashop in debug mode 5 - On the product page is where the error comes up

Thank you so much

myprestacomments (1).zip

tswfi commented 3 years ago

did a quick test and cannot replicate this. started the docker with 1.7.7.2 installed the provided module (and activated it) presta is in debug mode product page opens correctly changed setting for allowing guest reviews image and wrote one review and it still works.

etsmes commented 3 years ago

Now I see that in the test server it fails when setting "Position of comments: Product tabs" but in the production server it fails always, no matter the position you set

Thank you

tswfi commented 3 years ago

yup, now I can replicate this.

the problem is that myprestacomments module assigns nbComments smarty variable

1133             'nbComments' => (int)MyprestaComment::getCommentNumber((int)Tools::getValue('id_product')),

but does not assign 'ratings' smarty variable.

this then causes the template to try to read the rating average value here https://github.com/prestarocket-agence/classic-rocket/blob/master/templates/_partials/microdata-jsonld.tpl#L130

and that fails as ratings is not set.

this should help

diff --git a/templates/_partials/microdata-jsonld.tpl b/templates/_partials/microdata-jsonld.tpl
index 7511b9b..48f6b43 100644
--- a/templates/_partials/microdata-jsonld.tpl
+++ b/templates/_partials/microdata-jsonld.tpl
@@ -127,7 +127,7 @@
         "@type": "Thing",
         "name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}{$shop.name}{/if}"
     },{/if}
-    {if isset($nbComments) && $nbComments && $ratings.avg}"aggregateRating": {
+    {if isset($nbComments) && $nbComments && isset($ratings) && $ratings.avg}"aggregateRating": {
         "@type": "AggregateRating",
         "ratingValue": "{$ratings.avg|round:1|escape:'html':'UTF-8'}",
         "reviewCount": "{$nbComments|escape:'html':'UTF-8'}"

but that will leave ratings out of the microdata as ratings is not set.

The interesting thing is that I cannot find where ratings is set in vanilla 1.7.7.2 prestashop either...

Prestashop default comments module has a method that does get them from the db: https://github.com/PrestaShop/productcomments/blob/44abcd1a4cf338f740fe6869c25e0a890d40b7f5/ProductComment.php#L177 but it is not called anywhere...

etsmes commented 3 years ago

Thank you so much! i'm trying to fix it

etsmes commented 3 years ago

I can't fix it and the module developer is not responding. Do you have any idea how I could fix it? Thank you so much

tswfi commented 3 years ago

my suggested fix didn't work?

etsmes commented 3 years ago

@tswfi Sorry i answered so late. Thank you, it is working!

mrick01 commented 2 years ago

Hello, I bought modules and I got an answer and after nothing more in my emails, no more news, I got an error this morning in search console "module/myprestacomments/default" there is a blank page like fixing this bug? Thank

tswfi commented 2 years ago

Hello, I bought modules and I got an answer and after nothing more in my emails, no more news, I got an error this morning in search console "module/myprestacomments/default" there is a blank page like fixing this bug? Thank

did you check my comment here: https://github.com/prestarocket-agence/classic-rocket/issues/221#issuecomment-796657302

mrick01 commented 2 years ago

Hello, Yes but I don't think it's good, because when I click on mysite/module/myprestacomments/default, there is a 500 error, something is missing, however when I look at the error in debug, and I click on the link it says this: Warning: Invalid argument supplied for foreach() in /home/modules/pm_advancedcookiebanner/pm_advancedcookiebanner.php on line 1161

I don't understand why it tells me about the pm_advancedcookiebanner module, I tried to deactivate it but it doesn't change anything still error 500

tswfi commented 2 years ago

@mrick01 can you give steps to reproduce the problem using this docker config

https://github.com/prestarocket-agence/classic-rocket/pull/223

something like:

mrick01 commented 2 years ago

I do not understand your answer, my explanation is that I have an error in search console, via the myprestacomments module, but the developer does not answer me to help me, I think he is busy, but I have to solve this error 500

something is missing, however when I look at the error in debug, and click on the link it says this: Warning: Invalid argument provided for foreach() in /home/modules/pm_advancedcookiebanner/pm_advancedcookiebanner.php at line 1161

I don't understand why it tells me about the pm_advancedcookiebanner module, I tried to disable it but it doesn't change anything still error 500

tswfi commented 2 years ago

I need a way to replicate the problem to be able to help.

Also that sounds more like a bug in the pm_advancedcookiebanner than in the prestarocket theme.

mrick01 commented 2 years ago

Thank you for your answer, Yes but why the error in search-console indicates "module/myprestacomments/default" and when we click on it it sends a 500 error, and when I look in the debug and if I click on the link, then it indicates a problem via pm_advancedcookiebanner, I don't understand the report

How can I help reproduce the bug? because I'm a newbie


De : Tatu Wikman @.> Envoyé : mercredi 16 mars 2022 11:52 À : prestarocket-agence/classic-rocket @.> Cc : mrick01 @.>; Mention @.> Objet : Re: [prestarocket-agence/classic-rocket] error when debugging mode activated (#221)

I need a way to replicate the problem to be able to help.

Also that sounds more like a bug in the pm_advancedcookiebanner than in the prestarocket theme.

— Reply to this email directly, view it on GitHubhttps://github.com/prestarocket-agence/classic-rocket/issues/221#issuecomment-1068992037, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APNUTCTZ4EJ2ZHSWICVFESTVAG4QNANCNFSM4YTJPGJA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

mrick01 commented 2 years ago

My problem is that the url points to the myprestacomments "default" module folder, but there is no "default" folder in this module, and when I put the debug it gives me a 500 blank page error but with a link with the module "pm_advancedcookiebanner" I do not understand the link with its two modules

tswfi commented 2 years ago

Sorry, its close to impossible to debug something like this without being able to reproduce it (or having access to the server for debugging, and I don't log onto other people servers).

Check the logs, there might be some hints on what happens. Then debug where the calls go and try to figure out why it fails..

mrick01 commented 2 years ago

I understand, but I will wait for other people to give me some leads, or maybe they have already had this problem and will answer me.

mrick01 commented 2 years ago

Hi, I redirected to home, I can't leave a 500 error, and MyPresta hasn't answered my emails since Friday, I hope it will answer me

mrick01 commented 2 years ago

Do you have any news from "My Presta" because no news and response for 10 days, it does not respond anymore, I bought a module and I have a bug and no one to help me