Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding 7 days to orders management searches

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 10-07-2007, 03:50 PM
 
expert47 expert47 is offline
 

Senior Member
  
Join Date: Feb 2006
Posts: 101
 

Default 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
__________________
Expert47
(Marty)
X-cart ver 4.0.17 retired
X-Cart ver 4.1.8 Moved to new server! Operating Mucho Better
X-AOM (Love it!!)
X-cart 4.4.3 finally in test ..! Help!
Reply With Quote
  #2  
Old 10-07-2007, 05:58 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Adding 7 days to orders management searches

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

Me too!
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 10-11-2007, 08:52 AM
 
expert47 expert47 is offline
 

Senior Member
  
Join Date: Feb 2006
Posts: 101
 

Default Re: Adding 7 days to orders management searches

carpe,

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

Marty
__________________
Expert47
(Marty)
X-cart ver 4.0.17 retired
X-Cart ver 4.1.8 Moved to new server! Operating Mucho Better
X-AOM (Love it!!)
X-cart 4.4.3 finally in test ..! Help!
Reply With Quote
  #4  
Old 10-11-2007, 12:27 PM
 
Duramax 6.6L Duramax 6.6L is offline
 

X-Adept
  
Join Date: Dec 2006
Posts: 865
 

Default Re: Adding 7 days to orders management searches

I would like this also.
__________________
Xcart 5.1.6 Building New Store
Xcart4.6.4 Gold Plus
Xcart 4.6.4 Platinum
Smart Template,
Mail Chimp Upgrade
Checkout One (One Page Checkout)
Checkout One X-Payments Connector
Checkout One Deluxe Tools
Call For Price
On Sale Module
Buy Together Module
MAP Price MOD
Reply With Quote
  #5  
Old 01-01-2008, 09:58 AM
 
expert47 expert47 is offline
 

Senior Member
  
Join Date: Feb 2006
Posts: 101
 

Default 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
__________________
Expert47
(Marty)
X-cart ver 4.0.17 retired
X-Cart ver 4.1.8 Moved to new server! Operating Mucho Better
X-AOM (Love it!!)
X-cart 4.4.3 finally in test ..! Help!
Reply With Quote
  #6  
Old 01-11-2008, 02:59 PM
 
sportruck sportruck is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 70
 

Default 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.
Reply With Quote

The following user thanks sportruck for this useful post:
godboma (02-14-2011)
  #7  
Old 01-11-2008, 05:45 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Adding 7 days to orders management searches

GREAT mod! Thanks for posting this. Moving this thread to COMPLETED mods.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #8  
Old 01-13-2008, 12:34 PM
 
expert47 expert47 is offline
 

Senior Member
  
Join Date: Feb 2006
Posts: 101
 

Default 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
(Marty)
X-cart ver 4.0.17 retired
X-Cart ver 4.1.8 Moved to new server! Operating Mucho Better
X-AOM (Love it!!)
X-cart 4.4.3 finally in test ..! Help!
Reply With Quote
  #9  
Old 01-13-2008, 10:08 PM
 
expert47 expert47 is offline
 

Senior Member
  
Join Date: Feb 2006
Posts: 101
 

Default 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
__________________
Expert47
(Marty)
X-cart ver 4.0.17 retired
X-Cart ver 4.1.8 Moved to new server! Operating Mucho Better
X-AOM (Love it!!)
X-cart 4.4.3 finally in test ..! Help!
Reply With Quote
  #10  
Old 01-14-2008, 04:02 PM
 
sportruck sportruck is offline
 

Advanced Member
  
Join Date: Dec 2003
Posts: 70
 

Default 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.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:27 PM.

   

 
X-Cart forums © 2001-2020