Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default [Done v1.3.9b] Counter History issue in 1.3.9a

    Hi there,

    I recently upgraded a site from 1.3.8a to 1.3.9a. The admin counter history looked like this after upgrading:

    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1
    04/26/2010 1-1

    I compared the includes/counter.php file from v1.3.8a and v1.3.9a and found this code change:

    1.3.8a
    $counter_query = "select startdate, counter, session_counter from " . TABLE_COUNTER_HISTORY . " where startdate='" . $date_now . "'";
    $counter = $db->Execute($counter_query);
    if ($counter->RecordCount() <= 0) {
    $date_now = date('Ymd');
    $sql = "insert into " . TABLE_COUNTER_HISTORY . " (startdate, counter, session_counter) values ('" . $date_now . "', '1', '1')";
    $db->Execute($sql);
    $counter_startdate = $date_now;
    $counter_now = 1;
    } else {
    $counter_startdate = $counter->fields['startdate'];
    $counter_now = ($counter->fields['counter'] + 1);
    $session_counter_now = ($counter->fields['session_counter'] + $session_counter);
    $sql = "update " . TABLE_COUNTER_HISTORY . " set counter = '" . $counter_now . "', session_counter ='" . $session_counter_now . "' where startdate='" . $date_now . "'";
    $db->Execute($sql);
    }
    1.3.9a
    $sql = "insert into " . TABLE_COUNTER_HISTORY . " (startdate, counter, session_counter) values ('" . $date_now . "', '1', '1')
    on duplicate key update counter = counter + 1, session_counter = session_counter + " . (int)$session_counter;
    $db->Execute($sql);
    I put 1.3.8a code back in, and now the counter works fine. I'm not sure what the change in code was for, but it doesn't seem to be working correctly.

    Thanks!
    Danielle

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Counter History issue in 1.3.9a

    The code is working properly, but it requires that your database tables be updated properly first.

    Thus, the symptoms you describe suggest that you didn't upgrade your database structure properly, so your database isn't properly handling the duplicates anymore.

    It's important that you run zc_install to upgrade your database as part of the upgrade process.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Counter History issue in 1.3.9a

    Quote Originally Posted by DrByte View Post
    The code is working properly, but it requires that your database tables be updated properly first.

    Thus, the symptoms you describe suggest that you didn't upgrade your database structure properly, so your database isn't properly handling the duplicates anymore.

    It's important that you run zc_install to upgrade your database as part of the upgrade process.
    Yes I did do that already, and in the admin it does say the Database Patch Level is 1.3.9a.
    Danielle

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Counter History issue in 1.3.9a

    When you did the database-upgrade, did it tell you that it skipped anything?

    What messages are listed in your database's upgrade_exceptions table?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Counter History issue in 1.3.9a

    Quote Originally Posted by DrByte View Post
    When you did the database-upgrade, did it tell you that it skipped anything?

    What messages are listed in your database's upgrade_exceptions table?
    The only things skipped were the things mentioned in the upgrade thread, I can't remember what they were offhand, something to do with Paypal I believe?

    All the messages in the upgrade_exceptions table are related to add-ons. There were no messages about the counter_history table.
    Danielle

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Counter History issue in 1.3.9a

    Use phpMyAdmin and Export the structure-only of your counter_history table. Output to screen. Paste it here.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Counter History issue in 1.3.9a

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

    CREATE TABLE counter_history (
    startdate char(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
    counter int(12) DEFAULT NULL,
    session_counter int(12) DEFAULT NULL,
    PRIMARY KEY (startdate)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    Danielle

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Counter History issue in 1.3.9a

    Quote Originally Posted by Danielle View Post
    I'm not sure what the change in code was for
    http://www.zen-cart.com/forum/showthread.php?t=122543
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Counter History issue in 1.3.9a

    Yes, I saw that thread already, but we didn't have any issue with duplicates until the upgrade to 1.3.9a. There were literally thousands of records per day since the upgrade, all with 1-1. Anyways, it seems to be working fine with the old code for now.

    Thanks :)
    Danielle

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Counter History issue in 1.3.9a

    What version of MySQL?

    The only reason it should be making those duplicates is if your primary key isn't actually being enforced properly to prevent duplicates.
    In fact, it must not be enforced properly, because if it was, then the duplicates you reported would be impossible.

    Either that, or you're using a very old version of MySQL. Thus the question about which version of MySQL you're using.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Counter History
    By valerie6128 in forum General Questions
    Replies: 4
    Last Post: 28 Jun 2011, 05:55 PM
  2. Counter History
    By wwwursa in forum General Questions
    Replies: 5
    Last Post: 19 Oct 2010, 03:11 PM
  3. Replies: 14
    Last Post: 6 May 2010, 05:20 PM
  4. Counter History
    By aphro6677 in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 3 Mar 2010, 01:49 PM
  5. [Done 1.3.9] Counter History, Sessions and Spiders
    By CJPinder in forum Bug Reports
    Replies: 6
    Last Post: 13 Sep 2008, 02:07 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