Customize Admin Dashboard

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
CGrouse
Lieutenant (LT)
Lieutenant (LT)
Posts: 59
Joined: Tue Jun 10, 2008 12:44 pm

Customize Admin Dashboard

Post by CGrouse » Fri Sep 05, 2008 10:55 pm

By Default, the top left corner it shows

Past 7 Days and Past 6 Months

Any way to add in the Month to date? or even Year to Date?

Thanks

Chris

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Customize Admin Dashboard

Post by jmestep » Sat Sep 06, 2008 8:02 am

It looks like you might be able to do it in Admin/Dashboard/SalesOverTime.ascs.cs by adding two sections of code using the following that is already there as a pattern.

Code: Select all

   private void initMonthChart(bool forceRefresh)
    {
        string cacheKey = "39C69D16-CD5A-4287-8DD4-E21019A78B8E";
        CacheWrapper cacheWrapper = Cache[cacheKey] as CacheWrapper;
        if (forceRefresh || (cacheWrapper == null))
        {
            //LOAD VIEWS
            SortableCollection<KeyValuePair<DateTime, decimal>> salesByMonth = ReportDataSource.GetSalesForPastMonths(6, true);
            //BUILD BAR CHART
            WebChart.ColumnChart chart = (ColumnChart)SalesByMonthChart.Charts[0];
            for (int i = 0; i < salesByMonth.Count; i++)
            {
                int roundedTotal = (int)Math.Round(salesByMonth[i].Value, 0);
                chart.Data.Add(new ChartPoint(salesByMonth[i].Key.ToString("MMM yy"), roundedTotal));
            }
            chart.MaxColumnWidth = 30;
            //BIND THE CHART
            SalesByMonthChart.RedrawChart();
            //CACHE THE DATA
            cacheWrapper = new CacheWrapper(SalesByMonthChart.ImageID);
            Cache.Remove(cacheKey);
            Cache.Add(cacheKey, cacheWrapper, null, DateTime.UtcNow.AddMinutes(5).AddSeconds(-1), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.High, null);
        }
        else
        {
            //USE CACHED VALUES
            SalesByMonthChart.ImageID = (string)cacheWrapper.CacheValue;
        }
        _CacheDate = cacheWrapper.CacheDate;
    }
As a start, try changing
private void initMonthChart(bool forceRefresh) to another name, the cache key, and then ReportDataSource.GetSalesForPastMonths(6, true); to 12 instead of 6 for months
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

evanb@firefold.com
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 36
Joined: Mon Jul 21, 2008 3:45 pm

Re: Customize Admin Dashboard

Post by evanb@firefold.com » Mon Sep 08, 2008 10:18 am

Is there any significance in generating a new cache key? Or can you simply just change it to another string?
Besides renaming the section of code to my value, what else (if anything) needs to be changed?
Which values need to be linked to the SalesOverTime.ascx file?

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Customize Admin Dashboard

Post by jmestep » Mon Sep 08, 2008 11:16 am

On the cache key- I think it would have to be different because you are storing different data. On generating it, I just don't know. Maybe someone at Able can chime in.
On other changes that might be necessary, I didn't notice any, but I didn't try the code for real. I have a very "scientific" method when I do something like that- I change it and see what broke, what kind of error messages I got and fix what broke.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply