I'm trying to create a php file to be inserted in my Magento root that prints all the products and the associated fields.
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
$collection = $productCollection->create()
->addAttributeToSelect('*')
->load();
foreach ($collection as $product){
echo 'Name = '.$product->getName().'<br>';
}
?>
I found this that should print all the product names but give me this error:
Fatal error: Class 'Magento\Framework\App\ObjectManager' not found in ../../public_html/folder/file.php on line 3
The error is over
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
Help for pleasure