UK Date Formatting for Sales report 2.0
Hi,
Just tried this module out this morning and it's pretty handy - thanks! :clap:
Being from Ireland, the date formatting issues were a little irritating, but they were extremely simple to fix.
For anyone from the UK/Ireland, this is all you need to change:
In admin/includes/classes/sales_report.php change lines 58 and 59 from:
PHP Code:
$this->sd_raw = mktime(0, 0, 0, substr($sd, 0, 2), substr($sd, 3, 2), substr($sd, 6, 4) );
$this->ed_raw = mktime(0, 0, 0, substr($ed, 0, 2), substr($ed, 3, 2), substr($ed, 6, 4) );
to:
PHP Code:
if (strtolower(DATE_FORMAT) == 'm/d/y') {
// Use US date format (m/d/Y)
$this->sd_raw = mktime(0, 0, 0, substr($sd, 0, 2), substr($sd, 3, 2), substr($sd, 6, 4) );
$this->ed_raw = mktime(0, 0, 0, substr($ed, 0, 2), substr($ed, 3, 2), substr($ed, 6, 4) );
} else if (strtolower(DATE_FORMAT) == 'd/m/y') {
// Use UK date format (d/m/Y)
$this->sd_raw = mktime(0, 0, 0, substr($sd, 3, 2), substr($sd, 0, 2), substr($sd, 6, 4) );
$this->ed_raw = mktime(0, 0, 0, substr($ed, 3, 2), substr($ed, 0, 2), substr($ed, 6, 4) );
}
And in admin/includes/english/stats_sales_report.php change lines 114-118 from:
PHP Code:
define('TIME_DISPLAY_DAY', 'n-j-Y');
define('TIME_DISPLAY_WEEK', 'n-j-Y');
define('TIME_DISPLAY_MONTH', 'n-j-Y');
define('TIME_DISPLAY_YEAR', 'n-j-Y');
define('DATE_SPACER', ' thru<br/> ');
to:
PHP Code:
if (strtolower(DATE_FORMAT) == 'm/d/y') {
// Use US date format (m/d/Y)
define('TIME_DISPLAY_DAY', 'n-j-Y');
define('TIME_DISPLAY_WEEK', 'n-j-Y');
define('TIME_DISPLAY_MONTH', 'n-j-Y');
define('TIME_DISPLAY_YEAR', 'n-j-Y');
define('DATE_SPACER', ' thru<br/> ');
} else if (strtolower(DATE_FORMAT) == 'd/m/y') {
// Use UK date format (d/m/Y)
define('TIME_DISPLAY_DAY', 'jS-M-y');
define('TIME_DISPLAY_WEEK', 'jS-M-y');
define('TIME_DISPLAY_MONTH', 'jS-M-y');
define('TIME_DISPLAY_YEAR', 'jS-M-y');
define('DATE_SPACER', ' to<br/> ');
}
Of course, the above is assuming that you have changed your admin/includes/language/english.php file to use:
PHP Code:
define('DATE_FORMAT', 'd/m/Y');
define('DATE_FORMAT_SPIFFYCAL', 'dd/MM/yyyy');
Also, I've used jS-M-y as my preferred date output format... this affects the CSV output as well.
Some of you may prefer to use j-n-Y for more numerical formatting.. it's up to you (check PHP's date function documentation for more formatting options!).
Hope that is of help! :yes:
A note to blindside while I'm here...
First off, a great big thanks! :)
Secondly, the lines 693 and 1029 in the main stats_sales_report.php really need changing from <? to <?php - it seems silly to leave these as they are forcing users to have to make modifications. :blink:
Lastly, the comments in the Javascript should have the <?php and ?> tags removed from being around them, they result in parse errors here which causes the javascript to fail. Which is a pity because it makes it look as if the module doesn't work out of the box.
Thanks once again!
All the best...
Conor
ceon
2 Attachment(s)
2 installs 2 differert screens with different functionality
I just installed Sales Report 2.0 on zc1.3.7. First on my test server. It went smooth and appeared to function perfectly. Then on my live server. It installed smooth, but the page is different with mission functionality. The 'sort product by' and 'then sort product by' are missing.
I've attached the two different screen shots.
Thanks,
Airtime.
Re: 2 installs 2 differert screens with different functionality
Quote:
Originally Posted by
airtime
I just installed Sales Report 2.0 on zc1.3.7. First on my test server. It went smooth and appeared to function perfectly. Then on my live server. It installed smooth, but the page is different with mission functionality. The 'sort product by' and 'then sort product by' are missing.
I've attached the two different screen shots.
Just change the "Displayed Information" dropdown; the additional options appear/disappear based on your selection in that box.