Having trouble exporting products from Magento 2.x.

When I do an export from System > Export and select Entity Type of Products I'm receiving a Fatal Error.

Fatal error: Uncaught Error: Call to a member function getName() on null in C:\Web\gpp-magento2\vendor\magento\module-catalog-import-export\Model\Export\Product.php:442 Stack trace: #0 C:\Web\gpp-magento2\vendor\magento\module-catalog-import-export\Model\Export\Product.php(410): Magento\CatalogImportExport\Model\Export\Product->initCategories() #1 C:\Web\gpp-magento2\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(111): Magento\CatalogImportExport\Model\Export\Product->__construct(Object(Magento\Framework\Stdlib\DateTime\Timezone), Object(Magento\Eav\Model\Config), Object(Magento\Framework\App\ResourceConnection), Object(Magento\Store\Model\StoreManager), Object(Magento\Framework\Logger\Monolog), Object(Magento\Catalog\Model\ResourceModel\Product\CollectionFactory), Object(Magento\ImportExport\Model\Export\Config), Object(Magento\Catalog\Model\ResourceModel\ProductFactory), Object(Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory), Object(Magento\Catalog\Model\ResourceModel\Category in C:\Web\gpp-magento2\vendor\magento\module-catalog-import-export\Model\Export\Product.php on line 442

A little background about this magento2 project, we are in the slow process of moving away from our Mage 1.9 store. We have been through the migration process and tying up some loose ends. Today I ran into the above while attempting an export to test the functionality of exporting products and reimporting them to observe changes.

showing you where I'm seeing the error

  • Did you maybe check if any products have a blank/null name? Check in DB or just sort by name in Catalog -> Product – Lez Jan 12 '18 at 22:49
  • @Lez I think you're on to something, I took a look in the DB and it does seem like we are missing some product names. I'm not able to locate these missing names in the backend of magento. Will do some more digging tomorrow. Thanks for the response! – WO_PGH Jan 16 '18 at 4:47
  • @Lez I did some more digging and although I did see some null values within catalog_product_entity_varchar nothing is null or blank for attribute_id 96(product name) – WO_PGH Jan 26 '18 at 1:04
  • SELECT * FROM gpp.catalog_product_entity_varchar WHERE attribute_id = 96; .... Do you think by chance there is something wrong with the category name? – WO_PGH Jan 26 '18 at 1:05
  • Category names are good.. nothing null or blank catalog_category_entity_varchar WHERE attribute_id = 111 and store_id = 0; – WO_PGH Jan 26 '18 at 1:13

go to Fatal error: Call to a member function getName() on a non-object in app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php on line 173

replace :

$path[] = $collection->getItemById($structure[$i])->getName();


$path[] = $collection->getItemById($structure[$i])->getName();

Hope it will help you.

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.