More date range options in Order Manager

From AbleCommerce Wiki
Jump to: navigation, search

Intorduction

This topic is about adding more date ranges to order date filter on order manager. For example "yesterday" option

Customizations

First of all edit the Admin/Orders/Default.aspx.cs file and update its following method as bellow.

    private void ApplyLastDateFilter() 
    {
        
        _isCustomDateTime = false;
        DateTime tempDate = DateTime.Now.AddDays(-1);
        DateTime startDate = (new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, 0, 0, 0));
        DateTime endDate = (new DateTime(tempDate.Year, tempDate.Month, tempDate.Day,23, 59, 59));
        HiddenStartDate.Value = startDate.ToString();
        HiddenEndDate.Value = endDate.ToString();
    }

Now search the follwoing line in the file

DateFilter.Items.Add(new ListItem("Today","0"));

when found then put the following line of code just below it

DateFilter.Items.Add(new ListItem("Yesterday", "12"));

after this modification your code should look like

...
...
DateFilter.Items.Add(new ListItem("Today","0"));
DateFilter.Items.Add(new ListItem("Yesterday", "12"));
...
...

Now search the UpdateDateFilter() function and put the following line of code just after the case 11: in that function.

case 12:
//Last Day
ApplyLastDateFilter();
break;

After this modification your code should look like

...
...
case 11:
                //Custom Date
                ApplyCustomDateFilter();
                break;
            case 12:
                //Last Day
                ApplyLastDateFilter();
                break;
...
...

Thats all we are done here just navigate to the order manager and you will get your new date range option available there.

Reference

Originally posted in forums by Will http://forums.ablecommerce.com/viewtopic.php?f=45&t=6816