tashkas 2 Posted May 25, 2013 Can somebody tell me how to make display in product page how many times item have been viewed by customers, there is module best products but it just for backend, I want it in main page. Share this post Link to post Share on other sites
happykidsmart 0 Posted September 3, 2013 I want to see this feature as well ... many thanks. Share this post Link to post Share on other sites
vekia 8,952 Posted September 3, 2013 take a look here: http://www.prestashop.com/forums/topic/251539-solvedhow-to-get-product-view-count-in-prestashop/ Share this post Link to post Share on other sites
tashkas 2 Posted December 15, 2013 there is no solution in that link that you gave me Vekia, can somebody please share a solution how to do that? Share this post Link to post Share on other sites
vekia 8,952 Posted December 15, 2013 in Product.php class add function public static function getTotalViewed1($id_product) { $view1 = Db::getInstance()->getRow(' SELECT SUM(pv.`counter`) AS total FROM `'._DB_PREFIX_.'page_viewed` pv LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range` LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page` LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type` WHERE pt.`name` = \'product.php\' AND p.`id_object` = '.intval($id_product).''); return isset($view1['total']) ? $view1['total'] : 0; } then in product.tpl file you can use: {Product::getTotalViewed1(Tools::getValue('id_product'))} Share this post Link to post Share on other sites