I got the product collection in my custom template using the following snippet:
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection
$productCollection */
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
/** Apply filters here */
$productCollection->load();
foreach ($productCollection as $p)
{
echo "<pre>";
print_R($p->getData());
}
Here i got array with product id like this
Array
(
[entity_id] => 1
[attribute_set_id] => 4
[type_id] => virtual
[sku] => Double Corona Natural (box of 25)
[has_options] => 0
[required_options] => 0
[created_at] => 2015-12-23 09:20:38
[updated_at] => 2015-12-23 09:20:38
[is_salable] => 1
)
From this entity_id, how can I load products like we did in Magento 1.x?
$_product = Mage::getModel('catalog/product')->load($productID);