Guest Posted December 2, 2004 Share Posted December 2, 2004 (edited) What this contrib does: ========================= 1) Go to Admin -> Customers -> Orders -> Change the pull down Order Status to 'Pending' -> then back to 'All Orders'. 0 (zero) orders are listed. This code fixes that. 2) Reverse sort the 'Pending' orders (order status 1) so that the oldest order shows up first. This helps you take care of the orders that have been sitting the longest. 3) If an order sits in Pending for over 24 hours, the order number becomes colored red when viewing Pending orders. Other displays are unaffected. It was built and tested on 2.2 MS2. It should work on other versions with minor tweaking. Downloadable at http://www.oscommerce.com/community/contributions,2685 . Edited December 2, 2004 by jcall Quote Link to comment Share on other sites More sharing options...
gregy Posted December 2, 2004 Share Posted December 2, 2004 Hi i already used your fix and contrib, but red colour won't display order is in pending from 27.11. Does it have to something with language .. cause i translated word pending Quote Link to comment Share on other sites More sharing options...
Guest Posted December 2, 2004 Share Posted December 2, 2004 (edited) Yes, the word pending is hardcoded. It's easy to find, you can change it to whatever you've renamed "Pending" to. In the next release, I'll change that so that it looks for order status 1 rather than the name "pending". I just need to add a bit to one of the existing queries to pick up the order status rather than just the order name. -jared Edited December 2, 2004 by jcall Quote Link to comment Share on other sites More sharing options...
gregy Posted December 2, 2004 Share Posted December 2, 2004 Yes, the word pending is hardcoded. It's easy to find, you can change it to whatever you've renamed "Pending" to. In the next release, I'll change that so that it looks for order status 1 rather than the name "pending". I just need to add a bit to one of the existing queries to pick up the order status rather than just the order name. -jared <{POST_SNAPBACK}> would this be here? <!-- highlight if orders are Pending status and over 2 days old --> <?php if ($orders['orders_status_name'] == 'Sprejeto') { // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } } ?> i changed "Received" ? .. this is not pending? in original there was "Received" Quote Link to comment Share on other sites More sharing options...
Guest Posted December 2, 2004 Share Posted December 2, 2004 That's the one. I originally put it as "Received" in the Tips'n'Tricks area. I've changed my own statuts==1 to Received. Your change looks good. Augh! I just realized what you were saying - - I didn't change the contrib to reflect the stock order status name of Pending, like I'd intended! This: ======================================= STEP 4 (Highlight aging orders in Red) ======================================= still in catalog/admin/orders.php, just after the line following line (the one you just added): <td class="dataTableContent" align="center"><b> insert the following: <!-- highlight if orders are Pending status and over 2 days old --> <?php if ($orders['orders_status_name'] == 'Received') { // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } } ?> Should be this: ======================================= STEP 4 (Highlight aging orders in Red) ======================================= still in catalog/admin/orders.php, just after the line following line (the one you just added): <td class="dataTableContent" align="center"><b> insert the following: <!-- highlight if orders are Pending status and over 2 days old --> <?php if ($orders['orders_status_name'] == 'Pending') { // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } } ?> Unless, of course, you've renamed Pending like I (and you) have . . . Again, I'll fix this with the order status number rather than the name in the next couple of days. Sorry for the headache. -jared Quote Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2004 Share Posted December 4, 2004 Fixed by changing this: // begin reverse-sort Pending orders if ($status == 1) { $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC"; } to this: // begin reverse-sort Pending orders if ($status == 1) { $orders_query_raw = "select o.orders_status, o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC"; } (i.e. add the o.orders_status to the beginning of the query) and then change this line: <?php if ($orders['orders_status_name'] == 'Received') to this: <?php if ($orders['orders_status'] == '1') That should fix it. It worked for me, even after I renamed the status a couple of times. I'll upload a new copy in a few minutes. -jared Quote Link to comment Share on other sites More sharing options...
gregy Posted December 4, 2004 Share Posted December 4, 2004 it doesn't work for me .. i'll wait till tomorrow ( if those 2 day should do) and if that won't help, i'll put up backup, and start from new .. thanx Quote Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2004 Share Posted December 4, 2004 readme typo. It's 48 hours, not 24 hours. You can change it to be 24 hours easily enough, but it's currently 48 hours (and documented as such in the code). Sorry if that caused any headache. -jared Quote Link to comment Share on other sites More sharing options...
gregy Posted December 4, 2004 Share Posted December 4, 2004 readme typo. It's 48 hours, not 24 hours. You can change it to be 24 hours easily enough, but it's currently 48 hours (and documented as such in the code). Sorry if that caused any headache. -jared <{POST_SNAPBACK}> no problem at all .. we all are just expecting everything to work at the moment .. not waitting 48 hours .. i'll chage it to 1 hour .. just to see it working .. then i'll change it back to 24 ... thanx Quote Link to comment Share on other sites More sharing options...
gregy Posted December 4, 2004 Share Posted December 4, 2004 Hi jared sorry but this thing is not working .. i made backup and start on new, from new readme.txt in contribution ... i changed time to 3600 not 172800 and i tried all three status (1,2,3) and none is coloring orders .. two of them are 3 days old .. and on status 2 .. no way to color them ... i tried this in Firefox and in IE .. none is coloring .. where are these status numbers set in databse .. maybe i have changed numbers to any others .. but i really don't think i did that .. Quote Link to comment Share on other sites More sharing options...
gregy Posted December 4, 2004 Share Posted December 4, 2004 i'm back .. silly me :) i added $today_time = time(); into aplication_top.php not into orders.php .. i didn't read carefully .. but there is one thing .. red color shows up only if you select Pending orders .. it won't color them out when it displays All Orders (selected above on the right side of page) anyway .. this works .. could be done so it colors them also when selceted All Orders? thanx Quote Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2004 Share Posted December 4, 2004 Glad you got it working! I'll see about the All Orders - - should be fairly painless. Back in a jiffy. -jared Quote Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2004 Share Posted December 4, 2004 Just change this section <!-- highlight if orders are Pending status and over 2 days old --> <?php if ($orders['orders_status'] == '1') { // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } } ?> to this: <!-- highlight if orders are over 2 days old --> <?php // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } ?> That did it for me. -jared Quote Link to comment Share on other sites More sharing options...
gregy Posted December 4, 2004 Share Posted December 4, 2004 superb .. thank you for your time and effort ... i appreciate your work ... Quote Link to comment Share on other sites More sharing options...
Guest Posted December 4, 2004 Share Posted December 4, 2004 It's fun! (most of the time. <grin> ) -jared Quote Link to comment Share on other sites More sharing options...
100asa Posted January 13, 2005 Share Posted January 13, 2005 480960 how many times is? what's the numer for 15 days? Quote Skype: centoasa Skype: remigioruberto Link to comment Share on other sites More sharing options...
Guest Posted January 13, 2005 Share Posted January 13, 2005 if 2592000 = 30 days. 2592000/2 = 15 days = 1476000. -jared Quote Link to comment Share on other sites More sharing options...
lambro Posted April 2, 2005 Share Posted April 2, 2005 I added the code to each of my <td class="dataTableContent"> data tables (all of them after the one Jared told us to) which contain the order to make the whole row red and stand out even more, (I am colour blind so it helped me spot it easier). So they all start <td class="dataTableContent" align="center"> <!-- highlight if orders are over 2 days old --> <?php // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted April 5, 2005 Share Posted April 5, 2005 Great! Thanks for the addition. -jared Quote Link to comment Share on other sites More sharing options...
Graveyard666 Posted June 2, 2006 Share Posted June 2, 2006 how would i need to modify this code so only NEW orders are highlighted? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 2, 2006 Share Posted June 2, 2006 Try changing this: if ($time_since_order_placed > 172800) { to this: if ($time_since_order_placed < 172800) { That should highlight orders that have been placed in the last 2 days. -jared Quote Link to comment Share on other sites More sharing options...
Graveyard666 Posted June 2, 2006 Share Posted June 2, 2006 actually Jared, what would be better would be if each row could be highlighted depending on the order_status id processing = green pending = red i tried your solution but my client wants the background color highlighted and like i said above he wants the color based on the status id Quote Link to comment Share on other sites More sharing options...
Guest Posted June 2, 2006 Share Posted June 2, 2006 (edited) I believe that the orders_status field is already queried in that file. You'd want to do something like (this is pseudocode: if time < 2 days { switch orders_status { case 1: echo '<font color="red">'; break; case 2: echo '<font color="blue">'; break: } // end switch echo '</font>': } // end time-based status-sensitive coloring You can find out the number for order status in Admin by clicking on each order status (under localization IIRC) and watching the status= variable change in the URL. -jared Edited June 2, 2006 by jcall Quote Link to comment Share on other sites More sharing options...
Graveyard666 Posted June 3, 2006 Share Posted June 3, 2006 i just installed your contrib, steps 4+5 and it didnt work. those are the only parts of your contrib i need Quote Link to comment Share on other sites More sharing options...
cbcnz Posted June 4, 2006 Share Posted June 4, 2006 Whole thing works great for me !! I added another bit of code to highlight orders that have been status "on its way" for more than four days (easy to identify which orders can be updated to delivered and/or tracked down if the customer has not recieved it // begin reverse-sort Pending orders if ($status == 1) { $orders_query_raw = "select o.orders_status, o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC"; } else if ($status == 5) { $orders_query_raw = "select o.orders_status, o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.orders_status_id = '" . (int)$status . "' and ot.class = 'ot_total' order by o.orders_id ASC"; } // end reverse-sort Pending orders <?php // highlight if orders are Pending status and over 2 days old --> if ($orders['orders_status'] == '1') { // convert times to unix timestamp for comparison $time_since_order_placed = ($today_time - strtotime($orders['date_purchased']) ); // 172800 = 2 days in the unix timestamp format if ($time_since_order_placed > 172800) { echo '<font color=red>'; } } // highlight if orders are On its way status and over 4 days old --> if ($orders['orders_status'] == '5'){ // convert times to unix timestamp for comparison $time_since_order_updated = ($today_time - strtotime($orders['last_modified']) ); // 345600= 4 days in the unix timestamp format if ($time_since_order_updated > 345600) { echo '<font color=green>'; } } echo $orders['orders_id']; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.