Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    298
    Plugin Contributions
    0

    Default Count_product_views - disable or clear?

    The table count_product_views is currently at 90.5MiB going back to Oct 2020. Entire database is at 226MB. Thats an awful lot for a report we don't use since google analytics tells us more.
    If there a clean way to disable this? Or can i safely truncate the table periodically?
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

  2. #2
    Join Date
    Jul 2012
    Posts
    16,681
    Plugin Contributions
    17

    Default Re: Count_product_views - disable or clear?

    If you do not want to retain a count within Zen Cart of the products viewed, then its a two post process. First remove the auto loader includes/auto_loaders/config.products_viewed_counter.php from being loaded. (E.g., rename the config portion to something else or delete the file) then after that is done, can truncate the table to whatever time period you want including all records.

    Would suggest double checking that the data provides no use to you as one it is no longer collected in Zen Cart, it isn't easy to bring back, though not impossible to recreate in some way.

    Removal of that auto loader from the process, stops loading the observer that does the recording, which is located here: includes/classes/observers/class.products_viewed_counter.php

    After addressing the config file the above observer could also be removed in a similar way. Understand though that on your next upgrade, you will want to know our understand why there is some sort of difference between your current version and the new version.

    A meaningful way to accomplish the above may be to add some code and comment to the auto loader:
    Code:
    <?php
    /**
     *
     * @package statistics
     * @copyright Copyright 2003-2012 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version GIT: $Id: Author: DrByte  Tue Aug 28 14:21:34 2012 -0400 New in v1.5.1 $
     */
    /**
     * Designed for v1.5.1
     */
    if (!defined('IS_ADMIN_FLAG')) {
     die('Illegal Access');
    }
    return; // mc12345678 stop loading the products viewed counter forum thread: https://www.zen-cart.com/showthread.php?229672-Count_product_views-disable-or-clear
    $autoLoadConfig[190][] = array('autoType'=>'class',
                                  'loadFile'=>'observers/class.products_viewed_counter.php');
    $autoLoadConfig[190][] = array('autoType'=>'classInstantiate',
                                  'className'=>'products_viewed_counter',
                                  'objectName'=>'products_viewed_counter');
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,459
    Plugin Contributions
    121

    Default Re: Count_product_views - disable or clear?

    I'd prefer you to cull some data or even truncate table just in case you change your mind in the future.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Jun 2005
    Posts
    298
    Plugin Contributions
    0

    Default Re: Count_product_views - disable or clear?

    Thanks guys! Since there isn't a checkbox to disable, I'll probably just set a cron job to truncate it.
    2 + 2 = 5 for extremely large values of 2

    Pez Collectors Store

 

 

Similar Threads

  1. Clear comments
    By intcon in forum General Questions
    Replies: 4
    Last Post: 4 Feb 2011, 06:04 AM
  2. Images not clear
    By provida in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 7 Feb 2010, 07:02 PM
  3. How to Clear categories_description?
    By toussi in forum General Questions
    Replies: 5
    Last Post: 5 Oct 2009, 05:04 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