Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Batch Update Status Support


jefs.42

Recommended Posts

http://www.oscommerce.com/community/contributions,3749

 

Actually, been out a while but getting requests for help/comments, and Top Speed mentioned not being able to find a support thread so I'd thought I'd start one for the future :thumbsup:

 

Here's the orginal description I posted:

 

Needed a way to update the status of multiple orders at once. I know the batch printing contributions have a feature similar to this, but it only needed to update.

 

With this contribution there is a checkbox next to eac order on the orders page, you can select any or use the buttons to select all or none, choose the new status (pulled from database, so it's any you have setup), select whether to send the update status emails to the customers, and update them all real quick ;)

 

Also like to thank both Top Speed and expert for their help with various issues I missed/messed.

 

Feel free to suggest changes/additions that might be useful. The only thing I was planning thus far is to include a variable to set the number of current columns shown in the orders table, and using this to adjust the colspan="" tags from that (ie: the page #, jump box would be $variable+1, etc...).

 

 

Thanks, and I hope this proves useful for others as it has for me (OK, well, my clients, but you know... ;) ).

 

Jef S

Link to comment
Share on other sites

  • 6 months later...
  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

http://www.oscommerce.com/community/contributions,3749

 

Actually, been out a while but getting requests for help/comments, and Top Speed mentioned not being able to find a support thread so I'd thought I'd start one for the future :thumbsup:

 

Here's the orginal description I posted:

Also like to thank both Top Speed and expert for their help with various issues I missed/messed.

 

Feel free to suggest changes/additions that might be useful. The only thing I was planning thus far is to include a variable to set the number of current columns shown in the orders table, and using this to adjust the colspan="" tags from that (ie: the page #, jump box would be $variable+1, etc...).

Thanks, and I hope this proves useful for others as it has for me (OK, well, my clients, but you know... ;) ).

 

Jef S

 

Great contribution and has helped a lot. I still have an error meesage when I click on the order to add a comment and update. The error is

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/psa/home/vhosts/healthyandessential.co.uk/httpdocs/shop/admin/includes/languages/english/orders.php:89) in /usr/local/psa/home/vhosts/healthyandessential.co.uk/httpdocs/shop/admin/includes/functions/general.php on line 22

 

Any suggestions would be very helpful

 

Thanks

 

Paul

Link to comment
Share on other sites

  • 4 weeks later...

thanks for that! :)

 

 

i am wondering if anyone has been successful in merging batch update status to this contribution: http://www.oscommerce.com/community/contri...deleting+orders (archive deleted orders)

merging the two could offer speed upgrades to stores with old, obsolete orders taking up lots of space.. i've taken a stab at it tonight but didn't get anywhere yet.

 

 

 

i have added a bit to batch update status to allow a custom input box for each time you do a batch update (if you're like me, you're gonna use batch update a ton of times for different statuses all the time), so having a hard-coded comment wasn't gonna fly (it's also less personal and customers wonder what "batch update status" means).

 

all this does is add a text box next to the [select all] [select none] [update status] buttons.. and will send whatever you type in this box to the customer's email (if you tick the notify box) and append to the database's status comments.

 

 

to use it, backup /admin/orders.php

 

then find:

$comments = "Batch status update";

 

replace with:

	$comments = $comments;

 

 

find:

echo '<tr class="dataTableContent" align="center"><td colspan="6" nobr="nobr">' .

 

add below:

 tep_draw_textarea_field('comments', 'soft', '30', '5').

 

done :)

 

 

now, i've tested this on several different occasions on my shop and it works, but some of my contribution additions tend to not work for some people because i mistakenly use globals or share functions that are contribution/special coding that they don't have on their own shop.

 

before i add this to the contribution, anyone wanna test it? :)

Link to comment
Share on other sites

  • 2 weeks later...

Man, sorry I've been MIA for awhile. Glad this thing is helping out.

 

Guess I should work on my instructions better for any next updates. I see I got it right in the update file, and in the orders.php file, and completely left the old code in the install file. Sorry for all of you that had trouble with that.

 

Finally got a bit of time to play around with it again (and my test area back from some other jobs).

 

That comment box sounds really useful and I plan on trying that out after I get this thing all installed again. I'll let you know how it works out on mine but, obviuoslly, post it to the contribs anytime. That way others who may not check this thread can still get the benefit.

 

 

The combining with the order archive seems useful too. Not sure if that'd get posted to both contribs, one or the other, or possibly a new seperate one? This contrib uses whatever Statuses are setup in the store, so the main part would probably just involve copying the code that 'moves' the archvied ones into the main 'action' part of this one.

Link to comment
Share on other sites

Hey eww. yeah, the comments addition does work great. However, I did notice some things.

 

It was setup to only notify the customers of the status change, the "Batch Update Status" comment only went into the admin side for them to know. So, to get those to actually show up in the customer email you need to add some extra code:

 

Find, in first Batch Status code, around line 45

			$notify_comments = '';

 

and replace with:

			$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";

 

Otherwise it doesn't get into the email created just below this code, just into the admin view. Second isn't a big deal, just a 'display' issue (for me at least;), to give the whole area I nicer layout:

 

Replace from:

echo '<tr class="dataTableContent"><td valign="top" align="center" colspan="6" nobr="nobr">' .

Down to (and including for location help):

echo '<tr><td colspan="6">' . tep_black_line() . '</td></tr>';
?>
</form>

 

with:

echo '<tr class="dataTableContent"><td valign="bottom" align="center" colspan="4" nobr="nobr">' .   tep_draw_input_field('select_all',BUS_SELECT_ALL,'onclick="checkAll(); return false;"','','submit') .
 tep_draw_input_field('select_none',BUS_SELECT_NONE,'onclick="uncheckAll(); return false;"','','submit') .
 tep_draw_input_field('submit',BUS_SUBMIT,'','','submit') . '</td>';
echo '<td colspan="2" valign="top">' . ENTRY_NOTIFY_COMMENTS . '<br>' . tep_draw_textarea_field('comments', 'soft', '40', '3').'</td></tr>';
echo '<tr><td colspan="6">' . tep_black_line() . '</td></tr>';
?>
</form>

 

This puts the buttons on the left beneath the boxes/dropdown, and the comment box on the right just below the Notify customer's checkbox. And then the 40 width and 3 height of the textbox here:

 

tep_draw_textarea_field('comments', 'soft', '40', '3')

 

can be adjusted for any height width constraints as neccessary (I made it a bit wider and little shorter than in your original post).

 

 

Again, great addition. I'm gonna see if I can charge the clients I originally wrote this for to add it there :-"

Link to comment
Share on other sites

jefs.42, thanks for the updates!

 

i've tried relentlessly to merge this with the cancelled orders contribution, but i cannot figure out how to do it.

 

i've tried the ("1" being the shipped status):

if($status == "1"){
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

tep_archive_order($oID, $HTTP_POST_VARS['restock']);

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
}

no luck

i'm by far no php guru, so my trial and errors did not suffice this time :)

 

for an alternative, i've got a non-related script going through and grabbing all statuses that are older than 90 days (to ensure no scragglers get purged that may be needed in the near future):

select orders_id from orders where orders_status='1' and to_days(now()) - to_days(date_purchased) >= 90 order by last_modified desc limit 0,100

 

if you get a chance to incorporate batch update with cancelled orders, (in my opinion) a date and status range is a necessity :)

Link to comment
Share on other sites

Hi there,

 

I think this contribution is great and managed to inatall it with no problems.

 

I wondered though how easy it would be to be able to add the functionality to print the packingslips from the orders selected for batch updating?

 

Thanks

 

Dave

Link to comment
Share on other sites

I have that installed, it was just an idea as it would speed things up a little doing it all on the one page when you update the status.

 

Sometimes i have situaltions where a 10 or so orders on a page need packing slips printed and they are not in sequence, batch printer center isn't very userfriendly in this situation.

 

Anyway, as i said it was just an idea :)

 

Dave

Link to comment
Share on other sites

jefs.42, thanks for the updates!

 

i've tried relentlessly to merge this with the cancelled orders contribution, but i cannot figure out how to do it.

 

i've tried the ("1" being the shipped status):

if($status == "1"){
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

tep_archive_order($oID, $HTTP_POST_VARS['restock']);

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action'))));
}

no luck

i'm by far no php guru, so my trial and errors did not suffice this time :)

 

for an alternative, i've got a non-related script going through and grabbing all statuses that are older than 90 days (to ensure no scragglers get purged that may be needed in the near future):

select orders_id from orders where orders_status='1' and to_days(now()) - to_days(date_purchased) >= 90 order by last_modified desc limit 0,100

 

if you get a chance to incorporate batch update with cancelled orders, (in my opinion) a date and status range is a necessity :)

 

Still planning on it. I was hoping it would be a 'just upload these files on a clean osC'. But it's all file by file editing so it's taken longer to check into.

 

From looking at it though, I'm pretty sure it uses 1099 as the status id.

 

How would you see the date range working? If it's part of the same contrib would it archive those _in addition_ to any checked in the list above, or instead?

Link to comment
Share on other sites

Is there any way we can batch update the status for multi-orders with different comments? I would like to provide the tracking numbers when I update the status to shipped.

 

I'm not sure this sounds like a 'permanent' addition, since it's heading back to a 1-by-1 sort of scenario. Though if it's not a rush or anything, I could post the code to do it here? Maybe we should start a Batch Update Status Addons contrib ;)

 

Anyways, the way this would need done is to add a text field next to each checkbox and have it named relative to the orderID. So order ID 342's text field would be named comments342. Then while it's looping after submit you'd just set $comments and/or $notify_comments to the correct comments# for the current oID.

Link to comment
Share on other sites

I have that installed, it was just an idea as it would speed things up a little doing it all on the one page when you update the status.

 

Sometimes i have situaltions where a 10 or so orders on a page need packing slips printed and they are not in sequence, batch printer center isn't very userfriendly in this situation.

 

Anyway, as i said it was just an idea :)

 

Dave

 

I'm not particularly familiar with the Batch Print contrib, though I had looked at that first when the request came in from the client. However, it did seem either not userfriendly, or just too much for what they were looking for (plus they would be the ones using it not me ;) ).

It was for the Fur Peace Ranch guitar camp and they also have a lot of concerts going on, so tickets are a huge part of their sales. Since these aren't shipped and need no invoices/slips printed, they just needed a quick way to set them all to a 'Will Call' status.

Link to comment
Share on other sites

  • 2 months later...
I'm not particularly familiar with the Batch Print contrib, though I had looked at that first when the request came in from the client. However, it did seem either not userfriendly, or just too much for what they were looking for (plus they would be the ones using it not me ;) ).

It was for the Fur Peace Ranch guitar camp and they also have a lot of concerts going on, so tickets are a huge part of their sales. Since these aren't shipped and need no invoices/slips printed, they just needed a quick way to set them all to a 'Will Call' status.

 

 

I am sorry and I hope this isn't too forward of me... I've been working on matching this, excuse the enthousiasm, "wonderful" contribution... well it is for me as I use the update status all day long... in any case I was trying to get a batch printing feature to work as well but I am having issues having both codes work on the same page.

 

I've been at it for 7 nights in a row, many many hours each night. I've installed all of the batch print contributions one after the other. There was always something missing for my needs.

 

In the end I decided to just mix and match and at this point... I have invoice + packing slip or invoice or packingslip or labels on batch printing and it all works... I've had to use the code from 3 contributions to make it work. BUT... and here is my big BUT... none of the other contributions had the same hability then the Batch Status Update and I need that even more then I need batch printing.

 

So I end up reinstalling Batch Update Status... my problem now is that both option require checkboxes... and I am totally green at this php and js stuff so I am getting confused... Is there anyway to use the same checkboxes for 2 different applications... namely one would be Batch Update Status and the other would calling to my batch printing... or can I have 2 sets of checkboxes on a page and have no confusion between the two checkboxes scripts???

 

that's all that's left to be done... if I can find out if this type of coding is possible and if it is make it work on the order page... I would be able to share the end result of all this with you guys if you like within a few days. (I say a few days because I've never written instructions for a contribution and I want to make sure I do it right)

 

Again, being that I am a newcomer and a newbie, I hope this isn't too forward of me. ;)

Edited by mariemeh
Link to comment
Share on other sites

I forgot to say, I have both set ups ready... one set of checkboxes for both options or 2 sets of checkboxes one for each option... I mean the esthetics of it and I have no preference which one we use, I just need either one to work or both if possible and then we would have 2 views.

 

Thanks for any help at all.

Link to comment
Share on other sites

Hi

 

I have installed Batch Update and everything is working fine. I just need to do a minor change and was hoping you could help please.

 

The batch update leaves out the comments text box available for individual messages to the customer included in the update email. I've added a default message here in functions\html_output.php (// Output a form textarea field) so I'd like this to be included when I do the batch update.

 

Update individual order:

 

STORENAME

------------------------------------------------------

Order Number: 21

Detailed Invoice: https://..........

Date Ordered: Thursday 08 March, 2007

 

The comments for your order are

 

Thank you for this order, looking forward to the next!

 

 

 

Your order has been updated to the following status.

 

New status: Delivered

 

Please reply to this email if you have any questions.

 

Batch Update:

 

STORENAME

------------------------------------------------------

Order Number: 36

Detailed Invoice: https:/.....................

Date Ordered: Tuesday 13 March, 2007

 

Your order has been updated to the following status.

 

New status: Delivered

 

Please reply to this email if you have any questions.

 

Thank you in advance you your help.

Katie.

Link to comment
Share on other sites

I'm currently using my usual osC 'work' location for temporary on a current job I'm setting up, so can't try anything out with this combining right now.

 

The Batch Update Status form (which covers the list of orders and the buttons below, submits back to orders.php. The name of the checkboxes is update_oID[] which comes back to php as an array of all checked boxes.

 

Assuming that Batch Print also submits back to orders.php, either direction would work, but the 2 checkboxes would be easiest. Otherwise the name and variable would have to match across both. Either all the Batch Print checkbox related html/code would have to be switched to use update_oID, or the Batch Update would have to match the Print's names.

 

One plus is that as long as no New Status is selected, it doesn't matter which, if any, boxes are check - it still won't do any of the updating code.

Link to comment
Share on other sites

Hi

 

I have installed Batch Update and everything is working fine. I just need to do a minor change and was hoping you could help please.

 

The batch update leaves out the comments text box available for individual messages to the customer included in the update email. I've added a default message here in functions\html_output.php (// Output a form textarea field) so I'd like this to be included when I do the batch update.

 

Hi (again)

 

I've just found your posts of 7th Dec and sorted the above perfectly (apologies for not seeing it before)!

 

Many thanks for a great contribution.

Katie

Link to comment
Share on other sites

quote name='jefs.42' date='Mar 13 2007, 04:24 PM' post='1041971'

I'm currently using my usual osC 'work' location for temporary on a current job I'm setting up, so can't try anything out with this combining right now.

 

The Batch Update Status form (which covers the list of orders and the buttons below, submits back to orders.php. The name of the checkboxes is update_oID[] which comes back to php as an array of all checked boxes.

 

Assuming that Batch Print also submits back to orders.php, either direction would work, but the 2 checkboxes would be easiest. Otherwise the name and variable would have to match across both. Either all the Batch Print checkbox related html/code would have to be switched to use update_oID, or the Batch Update would have to match the Print's names.

 

One plus is that as long as no New Status is selected, it doesn't matter which, if any, boxes are check - it still won't do any of the updating code.

 

 

 

ok so 2 sets of checkboxes it is... now the batch print doesn't call to orders.php, it calls for another page... I am including below the code as it reads..

 

-------------------------

 

this is the code for the batch print option:

 

Code in the head tag:

<script language="javascript" src="includes/general.js"></script>

 

PHP Code calling for the option:

<?php echo tep_draw_form('batch_orders', 'print_batch_process.php', '', 'post', 'target="_blank"'). "\n"; ?>

 

Code for the checkall checkbox:

<td class="dataTableHeadingContent" align="right"><input name="allbox" type="checkbox" value="Check All" onclick="CheckAll(document.batch_orders);" /></td>

 

Code for the checkboxes that are next to each order:

<td class="dataTableContent" align="right"><?php echo tep_draw_checkbox_field('batch_order_numbers[' . $orders['orders_id'] . ']', 'no', '' , 'yes', 'onclick="CheckCheckAll(document.trackunread)'); ?></td>

 

PHP Code for the buttons:

<td class="smallText" align="right">With Selected - Invoice: <?php echo tep_draw_radio_field('target_file', FILENAME_ORDERS_INVOICE, true); ?> Labels: <?php echo tep_draw_radio_field('target_file', 'labels'); ?> | <?php echo tep_image_submit('button_confirm.gif', IMAGE_CONFIRM, 'align="absmiddle"'). "\n"; ?></td>

 

 

 

-------------------------

 

this is the code for the batch update option:

 

Code in the head tag:

<script language="javascript" src="includes/general.js"></script>

 

JS Code that shows on the page itself: (note that this code and the PHP code for Update Status, I had to move down just above the code for the checkboxes next to each orders... anywhere higher on the page and I was getting a conflict with the first set of checkboxes)

<script language="javascript">

function checkAll(){

var el = document.getElementsByName('update_oID[]')

for(i=0;i<el.length;i++){

el.checked = true;

}

}

function uncheckAll(){

var el = document.getElementsByName('update_oID[]')

for(i=0;i<el.length;i++){

el.checked = false;

}

}

 

</script>

 

 

PHP Code calling to the batch update option:

<?php

echo tep_draw_form('UpdateStatus', FILENAME_ORDERS,tep_get_all_get_params()); ?>

 

 

Code for the checkboxes that are next to each order:

<td class="dataTableContent"><input type="checkbox" name="update_oID[]" value="<?php echo $orders['orders_id'];?>"></td>

 

 

PHP Code for the buttons:

<?php

echo '<tr class="dataTableContent" align="center"><td colspan="6" nobr="nobr">' .

tep_draw_input_field('select_all',BUS_SELECT_ALL,'onclick="checkAll(); return false;"','','submit') .

tep_draw_input_field('select_none',BUS_SELECT_NONE,'onclick="uncheckAll(); return false;"','','submit') .

tep_draw_input_field('submit',BUS_SUBMIT,'','','submit') . '</td></tr>';

?>

 

-------------------------------

 

Now from you wrote above... what's happening at this point is that all of the batch print option is fully operational, but when I click the checkcheckall checkbox for it... both the batch print set of checkboxes adn teh batch update set of checkboxes gets checked...

 

the batch update status however... although it's showing as it should, when I click on the select all button only the batch update set of checkboxes gets checked but when I hit the update button, although the page refreshes... the status on the orders doesn't change... which leads me to believe that there is a conflict... only... I think I've twisted this so many ways now that I can't see straight... I don't get what's happening.

 

Any chance you could guide my pea brain on this??? Would it be easier if I were to post the code to the entire page or would you like to see a graphic at least of what it will look like if it ever works :blush:

 

Again, thank you for your time and consideration

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...