Jump to content

show products visitors and products bought number


finrodfelegund
 Share

Recommended Posts

so like title says i'd like to know if there's any simple way of showing this on product page, i saw that we can see this statistics in admin area but i cannot find the right place where to code is, maybe someone has more experience with this and could give me a tip :)

Thanks!

Share this post


Link to post
Share on other sites

i managed to get this code till now - and its showing the total views of all products i think what am i missing here?

{php}

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`
AND p.`id_object` = '.intval($id_product).'');
return isset($view1['total']) ? $view1['total'] : 0;
}

$totalViewed_1 = getTotalViewed1($product->id);
echo $totalViewed_1;
{/php}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More