View Single Post
  #1  
Old 02-04-2009, 11:55 AM
  BCSE's Avatar 
BCSE BCSE is offline
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,062
 

Default Quick Link to past 30 days orders

So we switched to 4.1.11 of X-cart back in early December. It was such a PITA to look at the past 30 days orders. So I made a quick link to the past 30 days orders. This should work for later versions of 4.1.x We have it working in 4.1.11

Here's what you do.
1. BACKUP ANY FILES YOU CHANGE.....
2. Make a copy of your admin/orders.php file, rename this copy to orders30.php
3. Open up orders30.php and find the line:
Code:
x_session_register("search_data");

AFTER that line insert:
Code:
# BCSE if(!empty($search_data[orders])) unset($search_data[orders]); $search_data[orders][sort_field] = 'orderid'; $search_data[orders][sort_direction] = 1; $search_data[orders][by_username]='on'; $search_data[orders][by_firstname]='on'; $search_data[orders][by_lastname]='on'; $search_data[orders][date_period]='T'; $search_data[orders][status]=''; $mode="search"; # BCSE

4. Open up include/orders.php and find this code:
Code:
elseif ($data["date_period"] == "W") { $first_weekday = $end_date - (date("w",$end_date) * 86400); $start_date = mktime(0,0,0,date("n",$first_weekday),date("j",$first_weekday),date("Y",$first_weekday)); }

AFTER it insert:
Code:
elseif ($data["date_period"] == "T"){ # BCSE added to do last 30 days $start_date = $end_date - (30 * 24 * 60 * 60); }

5. Add a link into your skin1/admin/menu.tpl below the line for orders. Example way you can do it.
Find:
Code:
<a href="{$catalogs.admin}/orders.php" class="VertMenuItems">{$lng.lbl_orders}</a><br />
After add:
Code:
<a href="{$catalogs.admin}/orders30.php" class="VertMenuItems">{$lng.lbl_orders} 30 Days</a><br />

That should do it!

Variation - Only last 30 days of processed orders. (NOTE if you want to do both the above and this one, ONLY do steps 1-3 and step 5. So do not repeat step 4 again)

1. BACKUP ANY FILES YOU CHANGE.....
2. Make a copy of your admin/orders.php file, rename this copy to orders30p.php
3. Open up orders30p.php and find the line:
Code:
x_session_register("search_data");

AFTER that line insert:
Code:
#BCSE if(!empty($search_data[orders])) unset($search_data[orders]); $search_data[orders][sort_field] = 'orderid'; $search_data[orders][sort_direction] = 1; $search_data[orders][by_username]='on'; $search_data[orders][by_firstname]='on'; $search_data[orders][by_lastname]='on'; $search_data[orders][date_period]='T'; $mode="search"; $search_data[orders][status]='P'; #BCSE

4. Open up include/orders.php and find this code:
Code:
elseif ($data["date_period"] == "W") { $first_weekday = $end_date - (date("w",$end_date) * 86400); $start_date = mktime(0,0,0,date("n",$first_weekday),date("j",$first_weekday),date("Y",$first_weekday)); }

AFTER it insert:
Code:
elseif ($data["date_period"] == "T"){ # BCSE added to do last 30 days $start_date = $end_date - (30 * 24 * 60 * 60); }

5. Add a link into your skin1/admin/menu.tpl below the line for orders. Example way you can do it.
Find:
Code:
<a href="{$catalogs.admin}/orders.php" class="VertMenuItems">{$lng.lbl_orders}</a><br />
After add:
Code:
<a href="{$catalogs.admin}/orders30p.php" class="VertMenuItems">{$lng.lbl_orders} 30 Days Processed</a><br />

Hope that helps some out there.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote