Created
October 21, 2018 12:35
-
-
Save zainengineer/d76a678865f0e96ebd5595f4067f0b08 to your computer and use it in GitHub Desktop.
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
//had NO EFFECT | |
$iStoreId = 9; | |
class_exists('\Kint',false) && (\Kint::$max_depth =3); | |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | |
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ | |
$storeManager =$objectManager->create('\Magento\Store\Model\StoreManagerInterface'); | |
//has NO EFFECT | |
$storeManager->setCurrentStore($iStoreId); | |
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepo */ | |
$productRepo = $objectManager->create('\Magento\Catalog\Api\ProductRepositoryInterface'); | |
/** @var \Magento\Framework\Api\SearchCriteriaBuilder $criteriaBuilder */ | |
$criteriaBuilder = $objectManager->create('Magento\Framework\Api\SearchCriteriaBuilder'); | |
$criteriaBuilder->setPageSize(10); | |
/** @var \Magento\Framework\Api\SearchCriteria $criteria */ | |
$criteria = $criteriaBuilder->create(); | |
$list = $productRepo->getList($criteria); | |
$readableList = []; | |
foreach ($list->getItems() as $product) { | |
$simple = $product->getData(); | |
$readableList[] = $simple; | |
} | |
return $readableList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment