Re: Sales report 2.0 (V3.2.0 PHP7)
Sales Report 2.0 (Version 3.2.0) PHP 7.x
The following changes are required as a minimum. My line numbers are higher than for the original files due to inserted comments for all changes I make.
file: YOUR_ADMIN\includes\classes\sales_report.php
where: at the top of the file approx line 29
Code:
define('DATE_FORMAT', 'd/m/Y'); // this is used for date() // BMH addition PHP 7
file: YOUR_ADMIN\includes\classes\sales_report.php
where: at approx lines 266, 270 CHANGE
Code:
if (count($this->timeframe[$id]['orders']) == 0) {
$this->timeframe[$id]['orders'] = false;
TO
Code:
if (empty($this->timeframe[$id]['products'])) {
$this->timeframe[$id]['orders'] = false;
file: YOUR_ADMIN\includes\classes\sales_report.php
where: at approx line 411 CHANGE
Code:
if (!in_array($pID, $this->timeframe[$id]['total']['diff_products'])) {
$this->timeframe[$id]['total']['diff_products'][] = $pID;
}
TO
Code:
if (!empty($this->timeframe[$id]['orders'][$oID]['diff_products']) ) {
if (!in_array($pID, $this->timeframe[$id]['orders'][$oID]['diff_products'])) {
$this->timeframe[$id]['orders'][$oID]['diff_products'][] = $pID;
}
}
file: YOUR_ADMIN\includes\classes\sales_report.php
where: at approx line 417 CHANGE
Code:
if (!in_array($pID, $this->timeframe[$id]['orders'][$oID]['diff_products'])) {
$this->timeframe[$id]['orders'][$oID]['diff_products'][] = $pID;
}
TO
Code:
if (!empty($this->timeframe[$id]['orders'][$oID]['diff_products']) ) {
if (!in_array($pID, $this->timeframe[$id]['orders'][$oID]['diff_products'])) {
$this->timeframe[$id]['orders'][$oID]['diff_products'][] = $pID;
}
}
Perform these changes in a test environment making only one change at a time and review your log files after each test of the report. Add comments to your code.