<div class="count-product">
<?php
$id = $id=$_helper->productAttribute($_product, $_product->getId(), 'id');
$mostviewedProducts = Mage::getResourceModel('reports/product_collection')->addViewsCount();
foreach($mostviewedProducts as $product) {
if($product->getData('entity_id')==$id)
{
//echo $id."<br/>";
//echo $_product->getId()."<br/>";
//echo $product->getData('entity_id')."<br/>";
echo "Total View Count: " . $product->getData('views');
}
}
?>
</div>
You can add time duration in
$fromDate = ‘2013-12-10’;
$toDate = now();
$mostviewedProducts = Mage::getResourceModel('reports/product_collection')->addViewsCount($fromDate,$toDate);
0 Comments