In Magento 2.3.1 the product.info.details
block has changed its class from Magento\Catalog\Block\Product\View\Description
to Magento\Catalog\Block\Product\View\Details
.
Magento 2.3.0
Magento 2.3.1
The Magento\Catalog\Block\Product\View\Description
class has the getProduct()
method:
The Magento\Catalog\Block\Product\View\Details
class does not have such method.
So any third-party design theme which calls the getProduct()
method in the product.info.details
block’s template will fail.
How to fix
In the Smartwave Porto’s case you need to patch the file app/design/frontend/Smartwave/porto_child/Magento_Catalog/templates/product/view/details.phtml
Step 1
Replace the 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
.
1 Like
Wow. Thanks! You saved my time.
Seems I’ve run into this as well, but on Mag 2.3.3 and the latest Porto theme. I’ve patched details.phtml, the page renders however javascript hangs. Note I’m using the child_theme which I believe to be the issue.
$block->getProduct()
grep -R '$block->getProduct()' ../../../../../../ *
../../../../../../Smartwave/porto/Smartwave_Dailydeals/templates/product/view/addtocart.phtml:<?php $_product = $block->getProduct(); ?>
../../../../../../Smartwave/porto/Magento_Checkout/templates/cart/item/configure/updatecart.phtml:<?php $_product = $block->getProduct(); ?>
../../../../../../Smartwave/porto/WeltPixel_Quickview/templates/product/view/gallery.phtml:$_product = $block->getProduct();
../../../../../../Smartwave/porto/Magento_Catalog/templates/product/view/details.phtml: /* $_product = $block->getProduct(); */
../../../../../../Smartwave/porto/Magento_Catalog/templates/product/view/prev_next.phtml: $_product = $block->getProduct();
../../../../../../Smartwave/porto/Magento_Catalog/templates/product/view/addtocart.phtml:<?php $_product = $block->getProduct(); ?>
../../../../../../Smartwave/porto/Magento_Catalog/templates/product/view/gallery.phtml:$_product = $block->getProduct();
../../../../../../Smartwave/porto/Magento_Catalog/templates/product/view/type/default.phtml:<?php $_product = $block->getProduct() ?>
../../../../../../Smartwave/porto/Magento_Catalog/templates/product/view/product_custom.phtml: $_product = $block->getProduct();
../../../../../../Smartwave/porto/Magento_GroupedProduct/templates/product/view/type/grouped.phtml:<?php $_product = $block->getProduct(); ?>
addtocart.phtml:<?php $_product = $block->getProduct(); ?>
details.phtml: /* $_product = $block->getProduct(); */
gallery.phtml:$_product = $block->getProduct();
prev_next.phtml: $_product = $block->getProduct();
product_custom.phtml: $_product = $block->getProduct();
type/default.phtml:<?php $_product = $block->getProduct() ?>