Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2006
    Posts
    87
    Plugin Contributions
    0

    Default Hit Counter from Admin Section

    Hi,

    May someone can help me out?

    I am trying to get the Hit Counter from the Admin section into the shop.

    I tried it with following code, put it in the footer.tpl

    <?php
    echo '<div align="center"> Visitors: ' . $counter->fields['counter'] . '</div><br />' . "\n";
    ?>


    but it shows only on the main page not on the other pages.
    What made I wrong?

    Using 1.38a


    Thank you

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Hit Counter from Admin Section

    Prior to displaying the counter you need to obtain the data from the counter table:
    PHP Code:
      $counter_query "select startdate, counter from " TABLE_COUNTER;
      
    $counter $db->Execute($counter_query);
      
    $counter_startdate $counter->fields['startdate'];
    //  $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4)));
      
    $counter_startdate_formatted strftime(DATE_FORMAT_SHORTmktime(000substr($counter_startdate42), substr($counter_startdate, -2), substr($counter_startdate04))); 
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Feb 2006
    Posts
    87
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    Thank you some much. Sometimes I got some on my eyes.

  4. #4
    Join Date
    Feb 2008
    Posts
    174
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    I'd really like to do this, as well!
    Where is footer.tpl?

    And would the full code look like this:

    PHP Code:
    <?php
      $counter_query 
    "select startdate, counter from " TABLE_COUNTER
      
    $counter $db->Execute($counter_query); 
      
    $counter_startdate $counter->fields['startdate']; 
    //  $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4))); 
      
    $counter_startdate_formatted strftime(DATE_FORMAT_SHORTmktime(000substr($counter_startdate42), substr($counter_startdate, -2), substr($counter_startdate04)));  
    echo 
    '<div align="center"> Visitors: ' $counter->fields['counter'] . '</div><br />' "\n";
    ?>
    ??

  5. #5
    Join Date
    Jul 2005
    Posts
    537
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    Okay, I have to rant ...

    Why do people put hit-counters on their websites? It strikes me as only beneficial to stroke the site-owner's ego, and possibly amateurish.

    It's just my opinion, but it seems to me that having a hit-counter is suitable for a MySpace site where teenagers are looking for proof of popularity.
    But for a professional eCommerce website running a business which provides valuable products for its customers ... a hit-counter shown to customers seems like a distraction and counter-productive.

    If you're trying to make it look like your site is popular when it isn't, why not spend energy on marketing and promoting your site, rather than staring at a hit-counter hoping it'll go up?

    Okay, rant over.

  6. #6
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,162
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    Easy chuckie,
    Do you need some coffee today.
    Mark
    Hare Do

  7. #7
    Join Date
    Feb 2008
    Posts
    174
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    Not helpful ;) my client wants a hit counter on her site.

  8. #8
    Join Date
    Feb 2008
    Posts
    174
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    ok found it - includes/templates/templates_default/common

    Works great!

  9. #9
    Join Date
    Apr 2009
    Location
    Oxford UK
    Posts
    192
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    How did you put the hit counter on there as my client wants one 2 :)

  10. #10
    Join Date
    Feb 2008
    Posts
    174
    Plugin Contributions
    0

    Default Re: Hit Counter from Admin Section

    I put the code found above in Ajeh's post (above) at the end of this file:

    yourstore/includes/templates/templates_default/common/tpl_footer.php

    I placed it as follows, just below the line:
    <!--eof- site copyright display -->

    PHP Code:
    <?php
      $counter_query 
    "select startdate, counter from " TABLE_COUNTER
      
    $counter $db->Execute($counter_query); 
      
    $counter_startdate $counter->fields['startdate']; 
    //  $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4))); 
      
    $counter_startdate_formatted strftime(DATE_FORMAT_SHORTmktime(000substr($counter_startdate42), substr($counter_startdate, -2), substr($counter_startdate04)));  
    echo 
    '<div align="center"> Visitors: ' $counter->fields['counter'] . '</div><br />' "\n";
    ?>
    and just above the very end of the file that looks like this:

    PHP Code:
    <?php

    // flag_disable_footer

    ?>

 

 

Similar Threads

  1. v139h Exclude my IP from hit counter?
    By mickyholmes in forum General Questions
    Replies: 2
    Last Post: 1 Oct 2012, 02:28 PM
  2. reset date on admin hit counter
    By kitcorsa in forum General Questions
    Replies: 6
    Last Post: 12 Jul 2010, 04:07 PM
  3. Question about admin hit counter? Please Help
    By mboley370 in forum General Questions
    Replies: 3
    Last Post: 8 Jul 2007, 05:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR