Created
May 29, 2017 19:29
-
-
Save bka/b42ba0ec7f70993f484d88f658623634 to your computer and use it in GitHub Desktop.
Iterate magento2 products
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$objectManager = $this->getObjectManager(); | |
$appState = $objectManager->get('Magento\Framework\App\State'); | |
$appState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML); | |
$productCollection = $objectManager->create("\Magento\Catalog\Model\ResourceModel\Product\Collection"); | |
$productCollection->addAttributeToSelect('*'); | |
foreach ($productCollection as $product) { | |
var_dump($product->getData()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment