X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Admin Sales Totals (https://forum.x-cart.com/showthread.php?t=65591)

Johnwiggity 12-07-2012 06:17 AM

Admin Sales Totals
 
1 Attachment(s)
On the Dashboard is it possible to show additional reports like yesterday, last week, last month, this year in the graphic?

Here's a screenshot of what it currently says.

totaltec 12-07-2012 08:01 AM

Re: Admin Sales Totals
 
There is a thread on this very subject...If I find it I'll point it out. But at least you know it is possible and the solution exists. Just need to find the needle in the haystack of this forum.

photo 12-07-2012 08:30 AM

Re: Admin Sales Totals
 
Quote:

Originally Posted by totaltec
There is a thread on this very subject...


This one? http://forum.x-cart.com/showthread.php?t=65186

Johnwiggity 12-07-2012 08:32 AM

Re: Admin Sales Totals
 
No. That's statistics and won't account for any orders other than processed.

totaltec 12-07-2012 09:29 AM

Re: Admin Sales Totals
 
Photo, that was the thread I had in mind. I thought it applied.

John, it looks relatively simple to do. Take a look at /admin/main.php

See line 57:
Code:

$start_dates[] = $previous_login_date;  // Since last login
$start_dates[] = func_prepare_search_date($curtime) - $config['Appearance']['timezone_offset']; // Today

$start_week = $curtime - date('w', $curtime) * 24 * 3600; // Week starts since Sunday

$start_dates[] = func_prepare_search_date($start_week) - $config['Appearance']['timezone_offset']; // Current week
$start_dates[] = mktime(0, 0, 0, date('m', $curtime), 1, date('Y', $curtime)) - $config['Appearance']['timezone_offset']; // Current month

These examples should give you what you need to setup your own searches. Just subtract from $curtime the number of seconds that you want to back.

Also take a look at the foreach statement
Code:

foreach($start_dates as $start_date) {
To see how the $start_dates array is treated, to better understand what is happening here.

Johnwiggity 12-07-2012 10:36 AM

Re: Admin Sales Totals
 
Thanks a lot I'll try it out.

Johnwiggity 12-08-2012 11:01 AM

Re: Admin Sales Totals
 
Still not really sure how to change the time period. A little confused on how to actually make that into a yesterday, last week, and last month.

totaltec 12-09-2012 09:37 AM

Re: Admin Sales Totals
 
Well, I would have to test it out and figure it out by trial and error myself.

1 week = 604800 seconds. I expect all of the values being processed by this script are in seconds.

This defines the current week, it simply adds another entry to the array $start_dates:
$start_dates[] = func_prepare_search_date($start_week) - $config['Appearance']['timezone_offset']; // Current week

You need to do the same. I would attempt first to simply use the equation above, and subtract 604800 seconds.

Why not:
$start_dates[] = func_prepare_search_date($start_week) - $config['Appearance']['timezone_offset'] - 604800; // Last week

Johnwiggity 12-10-2012 06:04 AM

Re: Admin Sales Totals
 
Thanks. That helps out and gives me an idea of how to mess with it.

minfinger 01-26-2013 01:25 PM

Re: Admin Sales Totals
 
Johnwiggity,

Did you ever figure out the line to put in the main.php to show the Year in the Admin Home?

minfinger 01-26-2013 05:59 PM

Re: Admin Sales Totals
 
I was looking at some thing and using the existing formulas in the main.php will only get my the previous 365 days. I want, for example from Jan 1, 2012 to Dec 31, 2012. But the existing query in the main.php and the $start_date formulas only account for a start date and do not set a range or end date. Or rather the formula does set the range, but it sets it as the $curtime.

Existing formula:
Code:

    $date_condition = "AND $sql_tbl[orders].date>='$start_date' AND $sql_tbl[orders].date<='$curtime'";

Any help?

Johnwiggity 01-28-2013 11:40 AM

Re: Admin Sales Totals
 
I never got it to work the way I wanted to.

minfinger 01-28-2013 12:22 PM

Re: Admin Sales Totals
 
I found another thread where a guy figured out how to do yesterday, last 7 and last 30. I'm not in the office eight now, but I'll look when I get back.

I think the best way is to have 2 types formulas working for to desperate sections. Unless I can figure out how to make the php set the end time through the code.

minfinger 01-28-2013 05:38 PM

Re: Admin Sales Totals
 
John,

I found the thread: http://forum.x-cart.com/showthread.php?t=49889

He talks about changing/adding this code to the main.php
Code:

$start_dates[] = mktime() - 24*3600
$start_dates
[] = mktime() - 7*24*3600
$start_dates
[] = mktime() - 30*24*3600




All times are GMT -8. The time now is 01:25 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.