Advertisement:

Author Topic: Hit counter for each ad  (Read 17934 times)

fuligjimmy

  • Newbie
  • *
  • Posts: 9
  • All questions are hard if you don't kno the answer
Re: Hit counter for each ad
« Reply #30 on: August 15, 2016, 02:09:05 pm »
Thanks Ramon, you guys are great. Let me explain how to add a simple "view counter" to each ad page so that other people with little PHP knowledge can also benefit:

1) Edit \oc-centent\themes\Modern\item.php file with an editor (Notepad, Notepad++ or any other that you use to edit PHP codes)

2) Add the following code to where you would like to have the counter displayed

<div id="Item hit counter">
  <?php _e('This page has been viewed', 'modern') ; ?>
  <?php echo osc_item_views(); ?>
  <?php _e('times', 'modern') ; ?>
  <BR>&nbsp;<BR>
 </div>

3) Save and upload item.php file back to your web server.
And this is it...

Thanks to apakar for this simple but great solution.
I've payed around with the code and made it work with my WizEstate theme from Osclass Wizards.

Check out the attached picture and if you think it's useful to you here it is:

Open \oc-content\themes\wizestate\item.php

Insert:

         <li>
        <ul id="Item hit counter">
           <li><i class="fa fa-eye"></i> <?php echo osc_item_views(); ?></li>
        </ul>
        </li>

After:
          <ul id="item_location">
            <li><i class="fa fa-map-marker"></i> <?php echo implode(', ', $location); ?></li>
          </ul>
          <?php }; ?>

Before:
</ul>
    </div>
    <?php
    if(function_exists('show_qrcode')){


Enjoy :-)