Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Add a products counter


Recommended Posts

How can I add a products counter and each time a visitor see a product, it counts +1 and all people can see the number of visits?





The value is already there in default oscommerce, this is from product_info.php:


tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

All you need to do is move that value up above the $product_info_query that's right above it, so it increments that value first, and then pull that value in addition to all of the others in the $product_info_query, and output it somewhere in the page with an "echo $$product_info['products_viewed']" statement...



Richard Lindsey

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...