I would like to load product view hit count for a specific product , i found that Magento database stores some counting in table e.g.
report_viewed_product_aggregated_daily
report_viewed_product_aggregated_monthly
How can I load this value for showing in frontend? Do I need to set date range on it?
Updates:
I try to use:
$collection = $objectManager->create('\Magento\Reports\Model\ResourceModel\Report\Product\Viewed\Collection')
to get the collection according to what it can be done on Magento 1.
Magento\Reports\Model\ResourceModel\Report\Product\Viewed\Collection
is extending:
\Magento\Sales\Model\ResourceModel\Report\Bestsellers\Collection
which is extending:
\Magento\Sales\Model\ResourceModel\Report\Collection\AbstractCollection
where there is a method setDateRange()
, but when I call it, it shows error "unknown method". Anyone have any idea about this?