Jump to content

Remove old stats


bos

Recommended Posts

I installed CubeCart in May 2015 as a testing site, but never actually started selling objects until August 2016.

In the Dashboard, I see "Sales statistics 2015-2016". But as I never sold anything earlier, those statistics are a bit redundant.

Question: Is it possible to wipe all stats up to, and including, July 2016?

Link to comment
Share on other sites

If the orders are inconsequential, then I am confident that deleting them will get you what you want.

(The following may depend on what version of CubeCart you have installed.) In admin, Orders, begin checking the checkboxes in the left-most column for those orders you have decided to delete (one page at a time). Then, at the bottom of the list, "With selected:", choose "Failed Fraud Review. This removes the order from any kind of calculation and possibly adds the inventory back into the stock levels. It should not send out an email to the customer.

That should remove them from the stats. But you may also want, for "then", choose Delete.

Link to comment
Share on other sites

Yes, CubeCart uses Google Charts, which has some apparent restrictions. It seems that the data array must have values and must have the same number of columns for each row.

Now, if it can be determined that an entire year has not had any sales, we can add code to suppress including the "prior year" chart data.

I should be able to figure out the code to do that.

 

Link to comment
Share on other sites

In the file /admin/sources/dashboard.index.inc.php:

Find near line 156:

$this_year = date('Y');
$last_year = $this_year - 1;

$chart_data['data'] = "['Month', '$this_year', '$last_year'],";

for ($month = 1; $month <= 12; $month++) {
	$m = date("M", mktime(0, 0, 0, $month, 10));
	$last_year_month = (isset($data[$last_year][$m]) && $data[$last_year][$m]>0) ? $data[$last_year][$m] : 0;
	$this_year_month = (isset($data[$this_year][$m]) && $data[$this_year][$m]>0) ? $data[$this_year][$m] : 0;
	$chart_data['data'] .= "['$m',  $this_year_month, $last_year_month],";
}

$chart_data['title'] = $lang['dashboard']['title_sales_stats'].': '.$last_year.' - '.$this_year;
$GLOBALS['smarty']->assign('CHART', $chart_data);



Change to:
  
$this_year = date('Y');
$last_year = $this_year - 1;
$last_year_ignore = (!count($data[$last_year])) ? true : false ;
$chart_data['data'] = "['Month', '$this_year'" . ( ($last_year_ignore) ? "" : ", '$last_year'" ) . "],";

for ($month = 1; $month <= 12; $month++) {
	$m = date("M", mktime(0, 0, 0, $month, 10));
	$last_year_month = (isset($data[$last_year][$m]) && $data[$last_year][$m]>0) ? $data[$last_year][$m] : 0;
	$this_year_month = (isset($data[$this_year][$m]) && $data[$this_year][$m]>0) ? $data[$this_year][$m] : 0;
	$chart_data['data'] .= "['$m',  $this_year_month" . ( ($last_year_ignore) ? "" : ", $last_year_month" ) . "],";
}

$chart_data['title'] = $lang['dashboard']['title_sales_stats'].': '. (($last_year_ignore) ? "" : $last_year.' - ') .$this_year;
$GLOBALS['smarty']->assign('CHART', $chart_data);

This adds a variable that is used to ignore last year if last year has no sales.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...