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)
-   -   Adding 7 days to orders management searches (https://forum.x-cart.com/showthread.php?t=34437)

expert47 10-07-2007 03:50 PM

Adding 7 days to orders management searches
 
Hi gang..

A pet peeve of mine since day one was the way orders management can search.. While it's fairly complete, there is one glaring option missing.. Having a LAST 7 DAYS, and no, not the previous week which on Monday searches only Sunday and Monday orders..

My thing is to have last 7 days, regardless when you do this, so if Oct 4 is Monday, it'll still pull the last few days in Sept and go back before Sunday..

I found some of where the code probably goes, but not all of it..

This can't be that big a deal, but I'd bet a lot of people would like this as an option..

There's bound to be one of the xcart programming guru's who can do this in 3-5 min.!

Thanks!

Marty

carpeperdiem 10-07-2007 05:58 PM

Re: Adding 7 days to orders management searches
 
Quote:

I'd bet a lot of people would like this as an option

Me too!

expert47 10-11-2007 08:52 AM

Re: Adding 7 days to orders management searches
 
carpe,

i guess we're the only ones..! hmm.. know anyone who could do this? :)

Marty

Duramax 6.6L 10-11-2007 12:27 PM

Re: Adding 7 days to orders management searches
 
I would like this also.

expert47 01-01-2008 09:58 AM

Re: Adding 7 days to orders management searches
 
well, now it's 1/1/08 and my idea of having a 7 or 14 day review is more noticable.. now you have to do 12/xx/07 to get back to last years items..

if anyone has a clue what to add to search this way let me know.. as xcart already has options for this month and this week, i can't imagine it's that complicated to add last 7 days and last 14 days..

there are several that have asked for it.. im sure someone that lives inside xcart code can do this..!

thanks!
marty

sportruck 01-11-2008 02:59 PM

Re: Adding 7 days to orders management searches
 
Here is what you need to modify:

In include/orders.php

Section of code just below

#
# Search by date condition
#


After this:

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));
                        }


Add:

Code:

                        elseif ($data["date_period"] == "7") {
                                $seven_days_ago = $end_date - 604800;
                                $start_date = mktime(0,0,0,date("n",$seven_days_ago),date("j",$seven_days_ago),date("Y",$seven_days_ago));
                        }



In skin1/main/orders.tpl

After this:

Code:

<td width="5"><input type="radio" id="date_period_W" name="posted_data[date_period]" value="W"{if $search_prefilled.date_period eq "W"} checked="checked"{/if} onclick="javascript:managedate('date',true)" /></td>
        <td class="OptionLabel"><label for="date_period_W">{$lng.lbl_this_week}</label></td>


Add:

Code:

<td width="5"><input type="radio" id="date_period_7" name="posted_data[date_period]" value="7"{if $search_prefilled.date_period eq "7"} checked="checked"{/if} onclick="javascript:managedate('date',true)" /></td>
        <td class="OptionLabel"><label for="date_period_7">7 days</label></td>


Above was done using xcart 4.1.9

The php is the same on 4.0.13 branch, but the tpl format changed slightly between 4.0.13 and 4.1.9. To apply this to an older version, just copy your existing code and change the form value and label as appropriate.

carpeperdiem 01-11-2008 05:45 PM

Re: Adding 7 days to orders management searches
 
GREAT mod! Thanks for posting this. Moving this thread to COMPLETED mods.

expert47 01-13-2008 12:34 PM

Re: Adding 7 days to orders management searches
 
SWEET...!!

Thanks loads. It's perfect!

marty


Quote:

Originally Posted by sportruck
Here is what you need to modify:



Above was done using xcart 4.1.9

The php is the same on 4.0.13 branch, but the tpl format changed slightly between 4.0.13 and 4.1.9. To apply this to an older version, just copy your existing code and change the form value and label as appropriate.


expert47 01-13-2008 10:08 PM

Re: Adding 7 days to orders management searches
 
Sportruk, Not to be picky here, but think you can add code to get to the 7 days in the Quick Menu, under Orders/User Management? im pretty sure it's just adding a variable but i know if i try, i'll screw it up!

thanks.. i've already used the 7 day option twice!

marty

sportruck 01-14-2008 04:02 PM

Re: Adding 7 days to orders management searches
 
To add the 7 days order search to the Quick Menu you need to change 2 php files.

The array for the quick menu is located in admin/quick_menu.php

After:
Code:

$quick_menu[$group_name][] = array ("link" => $xcart_catalogs["admin"]."/orders.php?date=W", "title" => func_get_langvar_by_name("lbl_search_this_week_orders"));

Add:
Code:

$quick_menu[$group_name][] = array ("link" => $xcart_catalogs["admin"]."/orders.php?date=7", "title" => "All orders last 7 days");

You also need to change include/orders.php

Change:
Code:

        #
        # Quick orders search
        #
        $go_search = false;
        if (!empty($date) && in_array($date, array("M","W","D"))) {
                $search_data["orders"]["date_period"] = $date;
                $go_search = true;
        }


To:
Code:

        #
        # Quick orders search
        #
        $go_search = false;
        if (!empty($date) && in_array($date, array("M","W","D","7"))) {
                $search_data["orders"]["date_period"] = $date;
                $go_search = true;
        }


To make this work you also need to add the "date condition" code to include/orders.php as described in my other post.


All times are GMT -8. The time now is 11:19 AM.

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