Jump to content

PS 1.7.8.0 - Error in FO - ps_googleanalytics


BlackCrow

Recommended Posts

I have an error with Prestashop 1.7.8.0 with PHP version 7.4:

ps_googleanalytics Version 4.1.0 - Error in Debug Mode in FrontOffice:

Quote

(1/1) ContextErrorException

Notice: Trying to access array offset on value of type null

in HookDisplayFooter.php line 90

at HookDisplayFooter->run()in ps_googleanalytics.php line 113

at Ps_Googleanalytics->hookDisplayFooter()in Hook.php line 997

at HookCore::coreCallHook()in Hook.php line 421

at HookCore::callHookOn()in Hook.php line 934

at HookCore::exec()in smarty.config.inc.php line 167

at smartyHook()in SmartyLazyRegister.php line 83

at SmartyLazyRegister->__call()in c5e87d25fdaa81882af365c2df3a02a365c83bc8_2.file.footer.tpl.php line 109

at Block_92258332861864674dd0578_81684157->callBlock()in smarty_internal_runtime_inheritance.php line 248

at Smarty_Internal_Runtime_Inheritance->callBlock()in smarty_internal_runtime_inheritance.php line 184

at Smarty_Internal_Runtime_Inheritance->process()in smarty_internal_runtime_inheritance.php line 156

at Smarty_Internal_Runtime_Inheritance->instanceBlock()in c5e87d25fdaa81882af365c2df3a02a365c83bc8_2.file.footer.tpl.php line 44

at content_61864674dd3f62_70876480()in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode()in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render()in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender()in 72882423d5ab6643d05f5a1996f68cb23fdd6cb7_2.file.layout-both-columns.tpl.php line 412

at Block_108123688361864674938e98_05813583->callBlock()in smarty_internal_runtime_inheritance.php line 248

at Smarty_Internal_Runtime_Inheritance->callBlock()in smarty_internal_runtime_inheritance.php line 184

at Smarty_Internal_Runtime_Inheritance->process()in smarty_internal_runtime_inheritance.php line 156

at Smarty_Internal_Runtime_Inheritance->instanceBlock()in 72882423d5ab6643d05f5a1996f68cb23fdd6cb7_2.file.layout-both-columns.tpl.php line 143

at content_6186467493c866_79746488()in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode()in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render()in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender()in smarty_internal_runtime_inheritance.php line 116

at Smarty_Internal_Runtime_Inheritance->endChild()in ea5dd2bb75316c34474624d05f45a3017df70020_2.file.layout-full-width.tpl.php line 42

at content_6186467491cdc7_95325248()in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode()in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render()in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender()in smarty_internal_runtime_inheritance.php line 116

at Smarty_Internal_Runtime_Inheritance->endChild()in 79c513919e517fd5f1fc20d1a38d50562d414aa8_2.file.page.tpl.php line 33

at content_6186467490eff5_08354557()in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode()in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render()in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_template.php line 385

at Smarty_Internal_Template->_subTemplateRender()in smarty_internal_runtime_inheritance.php line 116

at Smarty_Internal_Runtime_Inheritance->endChild()in f4354bafdc78ae776aea37e3361edfbae6ef0cd3_2.file.index.tpl.php line 33

at content_618646748ff430_83943256()in smarty_template_resource_base.php line 123

at Smarty_Template_Resource_Base->getRenderedTemplateCode()in smarty_template_compiled.php line 114

at Smarty_Template_Compiled->render()in smarty_internal_template.php line 216

at Smarty_Internal_Template->render()in smarty_internal_templatebase.php line 232

at Smarty_Internal_TemplateBase->_execute()in smarty_internal_templatebase.php line 116

at Smarty_Internal_TemplateBase->fetch()in SmartyCustom.php line 112

at SmartyCustomCore->fetch()in FrontController.php line 727

at FrontControllerCore->smartyOutputContent()in FrontController.php line 709

at FrontControllerCore->display()in Controller.php line 326

at ControllerCore->run()in Dispatcher.php line 518

at DispatcherCore->dispatch()in index.php line 28

 

i found the error in modules\ps_googleanalytics\classes\Hook\HookDisplayFooter.php -> line 90.

"in HookDisplayFooter.php line 90"

$products = $productWrapper->wrapProductList($listing['products'], [], true);

Changing to this (fix the error):

$products = $productWrapper->wrapProductList($listing['products'] ?? true, [], true);

i don't know if others have the same error or if my solution is correct.

can anyone confirm the error?

 

 

 

 

 

 

 

Link to comment
Share on other sites

  • 1 month later...
On 11/6/2021 at 10:15 AM, BlackCrow said:

I have an error with Prestashop 1.7.8.0 with PHP version 7.4:

ps_googleanalytics Version 4.1.0 - Error in Debug Mode in FrontOffice:

 

i found the error in modules\ps_googleanalytics\classes\Hook\HookDisplayFooter.php -> line 90.

"in HookDisplayFooter.php line 90"

$products = $productWrapper->wrapProductList($listing['products'], [], true);

Changing to this (fix the error):

$products = $productWrapper->wrapProductList($listing['products'] ?? true, [], true);

i don't know if others have the same error or if my solution is correct.

can anyone confirm the error?

 

 

 

 

 

 

 

It has also been resolved for me. Thank you for this
I'm using PHP 7.4 with PS1.7.8.2

Link to comment
Share on other sites

1 hour ago, BlackCrow said:

i have posted the issue on github:

https://github.com/PrestaShop/PrestaShop/issues/26539

 

Unfortunately, it has not been fixed yet...

Weird
I did this
modules\ps_googleanalytics\classes\Hook\HookDisplayFooter.php -> line 90.
 
$products = $productWrapper -> wrapProductList ( $listing [ 'products' ] ?? true , [], true );

And it works for me
It's weird that it works for me then?
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...