Jump to content

This doesn't seem to be a class name logger in PS 1.7


shacker

Recommended Posts

Hi. I try to update a module from PS 1.6 to 1.7. I added the use PrestaShop\PrestaShop\Core\Payment\PaymentOption;

 
 
and use this code (jsut to simplify)
 
  public function hookPaymentOptions()
{
 $newOption = new PaymentOption();
 $paymentForm = $this->fetch('module:mymod/views/templates/hook/payment.tpl');
 $newOption->setCallToActionText($this->trans('Pay by MyModule', array(), 'Modules.MyMod'));
 return [$newOption];
}

 

 

 

and i get that the error This doesn't seem to be a class name logger

 

Anybody have a clue?

 

 

Link to comment
Share on other sites

I found the code that generates that error on line 96 of src\Core\Foundation\IoC\Container.php:
        try {
            $refl = new \ReflectionClass($className);
        } catch (\ReflectionException $re) {
            throw new Exception(sprintf('This doesn\'t seem to be a class name: `%s`.', $className));
        }

It seems to be trying to instantiate the "logger" class, but it can't find it. I'm not sure why. I can see two Logger classes, one in vendor\monolog\monolog\src\Monolog\Logger.php and vendor\symfony\symfony\src\Symfony\Bridge\Monolog\Logger.php. I guess one of those needs to be included.

Link to comment
Share on other sites

 

Do you add this in the  public function __construct()

$this->page = basename(__FILE__, '.php');

?

 

and maybe add the params in 

 public function hookPaymentOptions($params)

already set that and same results: full log

 

  1. in Container.php line 96
  2. at Container->makeInstanceFromClassName('logger', array('logger' => true)) in Container.php line 158
  3. at Container->doMake('logger', array()) in Container.php line 171
  4. at Container->make('logger') in ServiceLocator.php line 55
  5. at ServiceLocator::get('logger') in HookManager.php line 68
  6. at HookManager->exec('paymentOptions', array(), nulltrue) in HookFinder.php line 70
  7. at HookFinder->find() in PaymentOptionsFinder.php line 59
  8. at PaymentOptionsFinderCore->find() in PaymentOptionsFinder.php line 95
  9. at PaymentOptionsFinderCore->present() in CheckoutPaymentStep.php line 75
  10. at CheckoutPaymentStepCore->render(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy))) in RenderableProxy.php line 52
  11. at RenderableProxy->render(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy))) in smartyfront.config.inc.php line 94
  12. at smartyRender(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))
  13. at call_user_func_array('smartyRender', array(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in SmartyLazyRegister.php line 83
  14. at SmartyLazyRegister->__call('smartyRender', array(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in smarty_internal_templatebase.php(157) : eval()'d code line 36
  15. at SmartyLazyRegister->smartyRender(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template)) in smarty_internal_templatebase.php(157) : eval()'d code line 36
  16. at content_58a1d2f3df1031_29484816(object(Smarty_Dev_Template)) in smarty_internal_templatebase.php line 188
  17. at Smarty_Internal_TemplateBase->fetch(nullnullnullnullfalsetruefalse) in SmartyDev.php line 60
  18. at Smarty_Dev_Template->fetch() in CheckoutProcess.php line 110
  19. at CheckoutProcessCore->render(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy))) in RenderableProxy.php line 52
  20. at RenderableProxy->render(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy))) in smartyfront.config.inc.php line 94
  21. at smartyRender(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))
  22. at call_user_func_array('smartyRender', array(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in SmartyLazyRegister.php line 83
  23. at SmartyLazyRegister->__call('smartyRender', array(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in smarty_internal_templatebase.php(157) : eval()'d code line 140
  24. at SmartyLazyRegister->smartyRender(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template)) in smarty_internal_templatebase.php(157) : eval()'d code line 140
  25. at content_58a1d2f36c1102_63778738(object(Smarty_Dev_Template)) in smarty_internal_templatebase.php line 188
  26. at Smarty_Internal_TemplateBase->fetch('checkout/checkout.tpl', null, 'layouts/layout-full-width.tpl', nullfalsetruefalse) in SmartyDev.php line 41
  27. at SmartyDev->fetch('checkout/checkout.tpl', null, 'layouts/layout-full-width.tpl') in FrontController.php line 655
  28. at FrontControllerCore->smartyOutputContent('checkout/checkout.tpl') in FrontController.php line 639
  29. at FrontControllerCore->display() in Controller.php line 221
  30. at ControllerCore->run() in Dispatcher.php line 366
  31. at DispatcherCore->dispatch() in index.php line 28
Link to comment
Share on other sites

You have to update logger location.

in src/Adapter/HookManager.php

Replace this 

$logger = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('logger');

with this

$logger = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('\\PrestaShop\\PrestaShop\\Adapter\\LegacyLogger');

Github link

https://github.com/PrestaShop/PrestaShop/commit/3371fd34d94791c962c305d0e1e423068b84cb2a

Link to comment
Share on other sites

Remove the code from the TPL files of the modules to test.

already did

 

this solve the issue

 

You have to update logger location.

in src/Adapter/HookManager.php

Replace this 

$logger = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('logger');

with this

$logger = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('\\PrestaShop\\PrestaShop\\Adapter\\LegacyLogger');

Github link

 

 

 

but now i have no payment methods, must check more

Link to comment
Share on other sites

  • 4 weeks later...

 

already set that and same results: full log

 

  1. in Container.php line 96
  2. at Container->makeInstanceFromClassName('logger', array('logger' => true)) in Container.php line 158
  3. at Container->doMake('logger', array()) in Container.php line 171
  4. at Container->make('logger') in ServiceLocator.php line 55
  5. at ServiceLocator::get('logger') in HookManager.php line 68
  6. at HookManager->exec('paymentOptions', array(), nulltrue) in HookFinder.php line 70
  7. at HookFinder->find() in PaymentOptionsFinder.php line 59
  8. at PaymentOptionsFinderCore->find() in PaymentOptionsFinder.php line 95
  9. at PaymentOptionsFinderCore->present() in CheckoutPaymentStep.php line 75
  10. at CheckoutPaymentStepCore->render(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy))) in RenderableProxy.php line 52
  11. at RenderableProxy->render(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy))) in smartyfront.config.inc.php line 94
  12. at smartyRender(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))
  13. at call_user_func_array('smartyRender', array(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in SmartyLazyRegister.php line 83
  14. at SmartyLazyRegister->__call('smartyRender', array(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in smarty_internal_templatebase.php(157) : eval()'d code line 36
  15. at SmartyLazyRegister->smartyRender(array('identifier' => 'checkout-payment-step', 'position' => '4', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template)) in smarty_internal_templatebase.php(157) : eval()'d code line 36
  16. at content_58a1d2f3df1031_29484816(object(Smarty_Dev_Template)) in smarty_internal_templatebase.php line 188
  17. at Smarty_Internal_TemplateBase->fetch(nullnullnullnullfalsetruefalse) in SmartyDev.php line 60
  18. at Smarty_Dev_Template->fetch() in CheckoutProcess.php line 110
  19. at CheckoutProcessCore->render(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy))) in RenderableProxy.php line 52
  20. at RenderableProxy->render(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy))) in smartyfront.config.inc.php line 94
  21. at smartyRender(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))
  22. at call_user_func_array('smartyRender', array(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in SmartyLazyRegister.php line 83
  23. at SmartyLazyRegister->__call('smartyRender', array(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template))) in smarty_internal_templatebase.php(157) : eval()'d code line 140
  24. at SmartyLazyRegister->smartyRender(array('file' => 'checkout/checkout-process.tpl', 'ui' => object(RenderableProxy)), object(Smarty_Dev_Template)) in smarty_internal_templatebase.php(157) : eval()'d code line 140
  25. at content_58a1d2f36c1102_63778738(object(Smarty_Dev_Template)) in smarty_internal_templatebase.php line 188
  26. at Smarty_Internal_TemplateBase->fetch('checkout/checkout.tpl', null, 'layouts/layout-full-width.tpl', nullfalsetruefalse) in SmartyDev.php line 41
  27. at SmartyDev->fetch('checkout/checkout.tpl', null, 'layouts/layout-full-width.tpl') in FrontController.php line 655
  28. at FrontControllerCore->smartyOutputContent('checkout/checkout.tpl') in FrontController.php line 639
  29. at FrontControllerCore->display() in Controller.php line 221
  30. at ControllerCore->run() in Dispatcher.php line 366
  31. at DispatcherCore->dispatch() in index.php line 28

 

 

I got the same error even for the fresh installation of version 1.7. 

 

Any clue on how to fix this? Hopefully Prestashop dev will fix it and upload a updated version.

Link to comment
Share on other sites

  • 3 months later...

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