//SAVE LOG DATA PER PRODUCT (DAILY)
//Stop Querying Data because module is no longer critical compare to the amount of Data generated
//$query_log_daily = "INSERT INTO products_log_daily";
//$query_log_daily .= " SELECT DATE(NOW()) log_date,";
//$query_log_daily .= " products_id, weekly_view, monthly_view, weekly_sold, sold_monthly_1, sold_monthly_2, sold_monthly_3";
//$query_log_daily .= " FROM products_log";
//tep_db_query($query_log_daily);
$logger->write("DONE - SAVE LOG DATA PER ARTICLE");
unset($articles);
//AVOID HALTED PROCESS WHEN ASSIGNING BIG ARRAY ON PRODUCTS STARS PROCESS BELOW
////////////////////
// PRODUCTS STARS //
////////////////////
$products_stars = array();
foreach ($products as $pid => $dt) {
    $stars = $class_pm->calculateStars($dt['sold_monthly_1']);
    $products_stars[$stars][] = $pid;
}
tep_db_query("UPDATE products SET stars = 0");
foreach ($products_stars as $stars => $pids_stars) {
    if ($stars > 0) {
        tep_db_query("UPDATE products SET stars = {$stars} WHERE products_id IN (" . implode(',', $pids_stars) . ")");
    }
}
$logger->write("DONE - PRODUCTS STARS");
unset($products);
/////////////////////////
// PRODUCTS STATIC LOG //
/////////////////////////
$year_static_log = date('Y', strtotime('-' . product::STATIC_LOG_LOOKBACK_TOLERANCE . ' days'));
product::generateStaticLog($year_static_log);