I’m trying to get all the products. I’m doing this way:
$objectManager->get('MagentoCatalogModelProduct')
->getCollection()
->addAttributeToSelect('*');
But only simple products are returned.
Getting the NOT RETURNED products by sku works fine:
$p = $objectManager->create('MagentoCatalogModelProductRepository')->get($sku);
Any idea?
Thanks in advance.
—
Magento version 2.2.0
2
Answers
Magento2 has concept call Factory, it is background to call model object. So I think you should new Factory before calling object model.
Try this
In your block file
and Your .phtml file
it gives the grouped and configurable product also
it wikk work for me please try this
you can try also this link:
https://www.mageplaza.com/how-get-product-collection-magento-2.html