X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Quick Link to past 30 days orders (https://forum.x-cart.com/showthread.php?t=45343)

BCSE 02-04-2009 11:55 AM

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

chikira 02-09-2009 08:50 PM

Re: Quick Link to past 30 days orders
 
Nice, Just implemented this without any issues.

Thanks Carrie

JWait 04-15-2011 08:07 AM

Re: Quick Link to past 30 days orders
 
Is there an update on this for newer versions? Thanks

BCSE 04-15-2011 10:21 AM

Re: Quick Link to past 30 days orders
 
Quote:

Originally Posted by JWait
Is there an update on this for newer versions? Thanks


Which version would you like? I might be inclined to program again and see if I can get it to work. :) I don't do much programming anymore since I am managing the business.

Thanks,

Carrie

JWait 04-15-2011 12:37 PM

Re: Quick Link to past 30 days orders
 
The latest version would make the most sense to me. I don't know about the 4.3 or 4.4 versions, but we have it working on 4.2.3 as it is now.... I just haven't had the time to check it out 4.4.2 other than to find that it loads "All" orders, not just the last 30 days.

BCSE 04-15-2011 12:56 PM

Re: Quick Link to past 30 days orders
 
Here you go for 4.4.2!!!

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 = func_prepare_search_date($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 skin/common_files/single/menu_box.tpl below the line for orders. Example way you can do it.
Find:
Code:

<a href="{$catalogs.admin}/orders.php?date=M">{$lng.lbl_this_month_orders}</a>
After add:
Code:

<a href="{$catalogs.admin}/orders30.php">Orders 30 days</a>


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 = func_prepare_search_date($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 skin/common_files/single/menu_box.tpl below the line for orders. Example way you can do it.
Find:
Code:

<a href="{$catalogs.admin}/orders.php?date=M">{$lng.lbl_this_month_orders}</a>
After add:
Code:

<a href="{$catalogs.admin}/orders30p.php">Orders 30 days Processed</a>


Hope that helps some out there.

Carrie

Vacman 11-02-2016 01:19 PM

Re: Quick Link to past 30 days orders
 
How about a Yesterday's Orders version? I played around with the line:

$start_date = $end_date - (30 * 24 * 60 * 60);

by changing it to 1 instead of 30, but it doesn't play nice...

BCSE 11-04-2016 11:40 AM

Re: Quick Link to past 30 days orders
 
Hi Carl,

Digging up a REALLY old thread huh? :D

Change the 1 to a 2 and it should work.

thanks

Carrie

Vacman 11-07-2016 03:17 PM

Re: Quick Link to past 30 days orders
 
Yeah, that "kind of" works. As long as you are not within 3 or 4 hours of the end or beginning of the day.


All times are GMT -8. The time now is 08:14 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.