3

we are using Magento 2.3.1 and Porto theme

when I click on product its showing below mentioned error - https://offineeds.co.in/4-in-1-touch-led-lamp.html

Fatal error: Uncaught Error: Call to a member function getData() on null in / home/offinee8/public_html/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/view/details.phtml:18
 Stack trace: 
 #0 /home/offinee8/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include() 
 #1 /home/offinee8/public_html/vendor/magento/framework/View/Element/Template.php(271): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Catalog\Block\Product\View\Details), '/home/offinee8/...', Array) 
 #2 /home/offinee8/public_html/vendor/magento/framework/View/Element/Template.php(301): Magento\Framework\View\Element\Template->fetchView('/home/offinee8/...') 
 #3 /home/offinee8/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(668): Magento\Framework\View\Element\Template->_toHtml() 
 #4 /home/offinee8/public_html/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Element\AbstractBlock->toHtml() 
 #5 /home/offinee8/public_html/vendor/magento/framework/View/Layout.php(533): M in /home/offinee8/public_html/app/design/frontend/Smartwave/porto/Magento_Catalog/templates/product/view/details.phtml on line 18
3

fix this issue using below steps :- In the Smartwave Porto’s Theme case you need to patch the file

app/design/frontend/Smartwave/porto_child/Magento_Catalog/templates/product/view/details.phtml

Step 1 : Replace this line:

$_product = $block->getProduct();

with the following code block:

$_product = \Magento\Framework\App\ObjectManager::getInstance()
    ->get(\Magento\Framework\Registry::class)->registry('product');

Step 2 : Then replace each $block->getProduct() expression with $_product.

Getting Reference

  • Thank you so much – Divya Jun 27 at 7:28
  • Works like a charm ! Thank you – sebb Jul 17 at 23:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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