Running SQL 5.6 this mod works great.
**5.7 and this lookup is no longer supported:
**
admin/stats_monthly_sales.php
line 470 - 482
$sales_query_raw = "SELECT sum(ot.value) gross_sales, monthname(o.date_purchased) row_month, year(o.date_purchased) row_year, month(o.date_purchased) i_month, dayofmonth(o.date_purchased) row_day from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id) WHERE ";
if ($get_status) {
$status = zen_db_prepare_input($get_status);
$sales_query_raw .= "o.orders_status =" . $status . " AND ";
}
$sales_query_raw .= "ot.class = " . $class_val_total;
$sales_query_raw .= $zone_only_sql;
if ($sel_month<>0) $sales_query_raw .= " AND month(o.date_purchased) = " . $sel_month;
$sales_query_raw .= "** group by **year(o.date_purchased), month(o.date_purchased)";
if ($sel_month<>0) $sales_query_raw .= ", dayofmonth(o.date_purchased)";
$sales_query_raw .= " order by o.date_purchased ";
if ($invert) $sales_query_raw .= "asc"; else $sales_query_raw .= "desc";
$sales_query = $db->Execute($sales_query_raw);
Admin output looks like:
WARNING: An Error occurred, please refresh the page and try again.
Logs error looks like:
PHP Fatal error: 1055:Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'njpbusin_155f_2018.o.date_purchased' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ::
SELECT sum(ot.value) gross_sales, monthname(o.date_purchased) row_month, year(o.date_purchased) row_year, month(o.date_purchased) i_month, dayofmonth(o.date_purchased) row_day from zen_orders o left join zen_orders_total ot on (o.orders_id = ot.orders_id) WHERE ot.class = 'ot_total' group by year(o.date_purchased), month(o.date_purchased) order by o.date_purchased desc
==> (as called by) /home/njpbusiness/public_html/shop/bRawn-aBc-scOot/stats_monthly_sales.php on line 482