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?
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');
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.
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.