cancel
Showing results for 
Search instead for 
Did you mean: 

Call to a member function getMetaTitle() on null

Call to a member function getMetaTitle() on null

I have been trying to export our product catalog from the Admin panel, but it fails every time.

 

Checking the error_log I see the following:

[19-Nov-2020 14:32:42 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getMetaTitle() on null in /home/devmoore/public_html/vendor/magento/module-catalog/Block/Product/Gallery.php:54
Stack trace:
#0 /home/devmoore/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(285): Magento\Catalog\Block\Product\Gallery->_prepareLayout()
#1 /home/devmoore/public_html/vendor/magento/framework/View/Layout/Generator/Block.php(149): Magento\Framework\View\Element\AbstractBlock->setLayout(Object(Magento\Framework\View\Layout\Interceptor))
#2 /home/devmoore/public_html/vendor/magento/framework/View/Layout/GeneratorPool.php(81): Magento\Framework\View\Layout\Generator\Block->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#3 /home/devmoore/public_html/vendor/magento/framework/View/Layout.php(350): Magento\Framework\View\Layout\GeneratorPool->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#4 /home/dev in /home/devmoore/public_html/vendor/magento/module-catalog/Block/Product/Gallery.php on line 54

I have checked the files listed and they all appear to be un-edited. The website still loads fine and no errors seem visible on the frontend.

 

Any idea what might cause this? The only changes that have been made to the site recently are to apply a patch to fix the date issue on PDF invoices. This was applied using composer, could something have broken related to this?

4 REPLIES 4

Re: Call to a member function getMetaTitle() on null

@Daniel_Moores ,

the issue should be there 
kindly check var/report folder if there any new files created for error 

find var/report -mmin -10

this will give you files created within last 10 mins 

 

also kindly watch logs using the tail command 

tail -f var/log/*.log

and try to export 

it will show you on the screen in case of any exception error.

 

Re: Call to a member function getMetaTitle() on null

@amitsamsukha thanks for the reply.

 

Nothing appears to be generated in the var/report folder.

 

[2020-11-20 13:16:55] main.CRITICAL: Notice: Undefined offset: 103 in /home/devmoore/public_html/vendor/magento/module-catalog-import-export/Model/Export/Product.php on line 1085 {"exception":"[object] (Exception(code: 0): Notice: Undefined offset: 103 in /home/devmoore/public_html/vendor/magento/module-catalog-import-export/Model/Export/Product.php on line 1085 at /home/devmoore/public_html/vendor/magento/framework/App/ErrorHandler.php:61)"} []

I have found online that the offset is the attribute. 103 is meta_title.

 

I had done some editing of attribute sets previously, so not sure if it's related to that.

Re: Call to a member function getMetaTitle() on null

Anyone have any ideas where to go next on this? Cannot solve this issue for the life of me!

Re: Call to a member function getMetaTitle() on null

You can try commenting on that line when you export 

    protected function _prepareLayout()
    {
        /* $this->pageConfig->getTitle()->set($this->getProduct()->getMetaTitle()); */
        return parent::_prepareLayout();
    }

if that works then override the class and put a condition over there for export. 

to override you need to create a module and implement preference in di.xml 

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
	<preference for="Magento\Catalog\Block\Product\Gallery" type="EmizenTech\UpdateforExport\Rewrite\Magento\Catalog\Block\Product\Gallery"/>
</config>

after that create a Block file and put the function with new conditions for export there. 

 

kindly Accept as a Solution if this works for you and give Kudos Smiley Happy