The number of results can be different than before, as the new query uses other data than the old query. I can for now not explain the empty page. I need to investigate that.
You can revert to the old query, by opening admin/stats_products_purchased.php in a text editor (like notepad++), and look for this code block starting at line 171 in Zen Cart 1.5.6:
PHP Code:
// The following OLD query only considers the "products_ordered" value from the products table.
// Thus this older query is somewhat deprecated
$products_query_raw1 = "SELECT p.products_id, SUM(p.products_ordered) AS products_ordered, pd.products_name
FROM " . TABLE_PRODUCTS . " p,
" . TABLE_PRODUCTS_DESCRIPTION . " pd
WHERE pd.products_id = p.products_id
AND pd.language_id = " . (int)$_SESSION['languages_id'] . "
AND p.products_ordered > 0
GROUP BY p.products_id, pd.products_name
ORDER BY p.products_ordered DESC, pd.products_name";
// The new query uses real order info from the orders_products table, and is theoretically more accurate.
// To use this newer query, remove the "1" from the following line ($products_query_raw1 becomes $products_query_raw )
$products_query_raw = "SELECT SUM(op.products_quantity) AS products_ordered, pd.products_name, op.products_id
FROM " . TABLE_ORDERS_PRODUCTS . " op
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id = op.products_id )
WHERE pd.language_id = " . (int)$_SESSION['languages_id'] . "
GROUP BY op.products_id, pd.products_name
ORDER BY products_ordered DESC, products_name";
Here yo change products_query_raw1 to products_query_raw1, on line 173, and products_query_raw1 to products_query_raw1 on line 184
Bookmarks