If anyone could help me.
My curent value that I get is '0' in my controller:
foreach($productCollection as $product)
{
$_helper_views =$this->helper_views->getProductCount($id);
}
and in my helper:
public function getProductCount($id)
{
// @var \Magento\Catalog\Model\Product\Interceptor $product
$prodData = $this->_prodCollection->addViewsCount()->getData();
if (count($prodData) > 0)
{
foreach ($prodData as $product)
{
if ($product['entity_id'] == $id)
{
return (int) $product['views'];
}
}
}
return 0;
}
and Yes this product have views. I checked in report_viewed_product_aggregated_monthly
and report_viewed_product_aggregated_weekly
tables.
When I change return to:
return $prodData;
I get full array of data.