0

Last night I updated our 3rd party payment module, when I did this I got an error under setup:upgrade called "area code is not set". Apparently, this was a Magento 2.4.3 bug and I used this to fix the bug: https://github.com/magento/magento2/commit/d0f220111548123a7a77102cc516b1043d54d905

But after this, we get a new error when we try and print packing slips: Notice: Undefined variable: layoutFactory in /chroot/home/xxxxx/xxxxxxxx/html/vendor/magento/module-payment/Helper/Data.php on line 180

Here is the code i did:

  {
    $layout = $layout ?: $layoutFactory->create();
    $blockType = $info->getMethodInstance()->getInfoBlockType();
    $block = $layout->createBlock($blockType);
    $block->setInfo($info);
    return $block;
}

Does anyone know what is wrong?

1 Answer 1

0

you can solve this by replacing

$layout = $layout ?: $layoutFactory->create()

; with

$layout = $layout ?: $this->layoutFactory->create();

 $layout = $layout ?: $this->layoutFactory->create();
 $blockType = $info->getMethodInstance()->getInfoBlockType();
 $block = $layout->createBlock($blockType);
 $block->setInfo($info);
 return $block;

And then you can create a patch or override the changes on your custom module.

3
  • Hi, I get this error now: Notice: Undefined property: Magento\Payment\Helper\Data\Interceptor::$layoutFactory in /chroot/home/xxxxx/xxxxxxx/html/vendor/magento/module-payment/Helper/Data.php on line 178 Commented Jan 18 at 14:21
  • Yes, try to replace $layoutFactory with $this->layoutFactory->create(); Commented Jan 18 at 14:28
  • I did replace it with $this->layoutFactory->create(); , then i got the new error i just added to the comment abover Commented Jan 18 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.