Admin Dashboard Order Statistics 2.2.x

Some have complained about the Order Statistics being removed from the Admin Dashboard and I will have to admit, it was bugging the hell out of me as well not being able to see the various order status statistics. For the most part the code is still in the file but for some reason CSC has opted to keep it hidden for now as you will see in the code. Anyway, I have re-enabled it and edited it to look somewhat decent.



In /skins/basic/admin/views/index/index.tpl replace:

```php {if $show_orders && false} {* Hide section for a while *}










{foreach from=$order_statuses item="status" key="_status"}







{/foreach}






















{$lang.status} {$lang.this_day} {$lang.this_week} {$lang.this_month} {$lang.this_year}
{include file="common_templates/status.tpl" status=$_status display="view"} {if $orders_stats.daily_orders.$_status.amount}{$orders_stats.daily_orders.$_status.amount}{else}0{/if} {if $orders_stats.weekly_orders.$_status.amount}{$orders_stats.weekly_orders.$_status.amount}{else}0{/if} {if $orders_stats.monthly_orders.$_status.amount}{$orders_stats.monthly_orders.$_status.amount}{else}0{/if} {if $orders_stats.year_orders.$_status.amount}{$orders_stats.year_orders.$_status.amount}{else}0{/if}
{$lang.total_orders} {if $orders_stats.daily_orders.totals.amount}{$orders_stats.daily_orders.totals.amount}{else}0{/if} {if $orders_stats.weekly_orders.totals.amount}{$orders_stats.weekly_orders.totals.amount}{else}0{/if} {if $orders_stats.monthly_orders.totals.amount}{$orders_stats.monthly_orders.totals.amount}{else}0{/if} {if $orders_stats.year_orders.totals.amount}{$orders_stats.year_orders.totals.amount}{else}0{/if}
{$lang.gross_total} {include file="common_templates/price.tpl" value=$orders_stats.daily_orders.totals.total|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.weekly_orders.totals.total|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.monthly_orders.totals.total|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.year_orders.totals.total|default:"0"}
{$lang.totally_paid} {include file="common_templates/price.tpl" value=$orders_stats.daily_orders.totals.total_paid|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.weekly_orders.totals.total_paid|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.monthly_orders.totals.total_paid|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.year_orders.totals.total_paid|default:"0"}


{/if} ```

with:
```php {if $show_orders} {* Do not Hide section for a while - The Tool *}

{include file="common_templates/subheader_statistic.tpl" title=$lang.orders_statistics}









{foreach from=$order_statuses item="status" key="_status"}







{/foreach}






















{$lang.status} {$lang.this_day} {$lang.this_week} {$lang.this_month} {$lang.this_year}
{include file="common_templates/status.tpl" status=$_status display="view"} {if $orders_stats.daily_orders.$_status.amount}{$orders_stats.daily_orders.$_status.amount}{else}0{/if} {if $orders_stats.weekly_orders.$_status.amount}{$orders_stats.weekly_orders.$_status.amount}{else}0{/if} {if $orders_stats.monthly_orders.$_status.amount}{$orders_stats.monthly_orders.$_status.amount}{else}0{/if} {if $orders_stats.year_orders.$_status.amount}{$orders_stats.year_orders.$_status.amount}{else}0{/if}
{$lang.total_orders} {if $orders_stats.daily_orders.totals.amount}{$orders_stats.daily_orders.totals.amount}{else}0{/if} {if $orders_stats.weekly_orders.totals.amount}{$orders_stats.weekly_orders.totals.amount}{else}0{/if} {if $orders_stats.monthly_orders.totals.amount}{$orders_stats.monthly_orders.totals.amount}{else}0{/if} {if $orders_stats.year_orders.totals.amount}{$orders_stats.year_orders.totals.amount}{else}0{/if}
{$lang.gross_total} {include file="common_templates/price.tpl" value=$orders_stats.daily_orders.totals.total|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.weekly_orders.totals.total|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.monthly_orders.totals.total|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.year_orders.totals.total|default:"0"}
{$lang.totally_paid} {include file="common_templates/price.tpl" value=$orders_stats.daily_orders.totals.total_paid|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.weekly_orders.totals.total_paid|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.monthly_orders.totals.total_paid|default:"0"} {include file="common_templates/price.tpl" value=$orders_stats.year_orders.totals.total_paid|default:"0"}



{/if} ```

[attachment=4559:Administration panel_1316319554077.png]

Administration panel_1316319554077.png

[size=“5”]AWESOME![/size]



I was already getting a couple of the employees who were complaining because it took a little more to find out which orders were new and that they needed to import in to our accounting system. Now they can easily see it again! Especially since I just upgraded 2 of our other pro sites this weekend. I wasn't looking forward to listening to the griping.



I have to admit though, I too HATED the change too! If I wanted to get a quick view of what was happening I had to go through more steps to get it when before I could just log in and look at the main page. The “Orders Today” part at the top is a little messed up and didn't really give an accurate view. If my employees didn't ship anything then the number was accurate, but once they started to ship things they would go off the “total sales” and did not show on the main page anymore.



With the old “Order Statistics” you brought back we can quickly see what orders have shipped, the total for the day and it is faster and easier to see which orders are declined and need additional attention.



I am still VERY confused as to why CS took this portion out. I guess this does bring up a good point. Different people like different things on their main admin. Maybe the way to do it is to make the main admin page have a “blocks” page where we can put what we want on the main admin page. Just a thought.



Again, many thanks to “The Tool” for helping out us code rookies who would not have a clue on how to fix this.

Thanks Tool,



This is something I used almost daily to just watch over what is happening. Glad it was to have it back.



dave

I am fairly new to CS-Cart and only used v2.1.4 for a brief time before upgrading now to 2.2.2 PRO. These brief order stats are a great quick summary and even though I did not get a chance to miss them, I'm glad there is a way to have them back. Maybe the developers will bring them back for good in the next upgrade? Thanks for the work!

REMOVED

What does a:

{$date|print_r:true}


Show you for the date array. That will tell you what the elements are.

StellarBytes, Why are you posting this in this thread? This thread has nothing to do with with the top statistics you are referring to.

REMOVED

Looks like the $date variable (for this controller anyway) is returning the data of today, 1 week ago and one month ago. Looks like it skipped the year.



You can always search the 'controllers' tree for “assign('date” and see what you come up with…

No, the code I posted has nothing to do with the top statistics (comparing day, week, month order totals). It only deals with the “Order statistics”. Look at the image in the original post and you will see a statistic at the top (code you referred to in your post) and then further down you will see “Order statistics”.



Maybe that is the reason you cannot get it to work?

Wow, a simple fixed has been made VERY confusing now! Sure would be nice if this new information would be moved to another thread so it doesn't confuse those who come along later and just want the old order statistics back on the main admin page. When I first started seeing post added to this thread I couldn't follow how it applied. I'm glad I didn't do it and hope that again, the new information gets it's own thread so it does not confuse others.

I have created a new thread for Dashboard Order Summary Totals for Day, Week, Month and Year. Please follow the new thread here if you would like to show Year (and Previous year) statistics as well as the Day, Week and Month as already shown in the Admin Dashboard.



Thank you and sorry for any confusion caused.

Any idea why this would display incorrectly? I have two custom order statuses, but this appears to be working erratically.



I'll simplify things as much as possible to try to make the explanation clearer. For example:



Today Total: £1000



But today we received one order for £500, another for £500 and one more for £100.



These orders all use the same custom order Status (which is actually just 'Open' renamed, thus, Status code is still 'O'), so why is the Total showing £1000 when it should be £1100?



The totals are wrong for this 'Order Statistics' box as well as the default order summary (today, yesterday, this week, last week, this month, last month).



Has anyone come across this and found a fix? Thanks in advance

So does this look like it is going to be as easy to put back in 3.0 as it was 2.2.4? I'm still confused as to why CS discontinued it.

It's going to be nasty by the look of it. Going to have to look into how to make addons work with Professional and Ultimate - as it stands the addon for dashboard statistics and order messages CS-Cart developed for a 2.2.4 store does not work in v3 Professional. Time to ask the question…