-------------------------------
HOW TO INSTALL THE ORDER EDITOR
-------------------------------
1) Copy the MAIN edit_orders.php file to your /admin/ folder.

2) Copy the LANGUAGE edit_orders.php file to your /admin/includes/languages/english/ folder. 

3) Set up a link somewhere to go to the tool. To edit order #536, you would access the tool like: /admin/edit_orders.php?oID=536

That's it!

----------------
ADDITIONAL NOTES
----------------

ADDING AUTO-CALCULATED TAX ENTRY:
If an order does not already have a "Tax" entry, you can add a tax field that will get calculated automatically. Just select the blank spot in the order totals where you want the tax field to appear, and give it a name of "Tax:" or "Tax". Update your order and the Tax field will appear, with all the calculated tax in it. If you want to completely delete the tax, just erase its name, and update the order again. (This also works with any other order total entry that you can change).


SHIPPING TAX:
Unfortunately, the tax class for shipping is not saved in the final order. This leaves us only with the textual description of what the shipping is called. So there is no way to re-process the tax for shipping automatically and accurately every time. So, what I've added is a variable on or around line 60 called $AddShippingTax.

If you want to add a flat tax rate to shipping, change the $AddShippingTax variable to the tax percentage you want to add (don't add the percent sign). Then, whenever you update the order, the tax will be re-calculated and this tax rate will be included in the calculations. This only works if you use tax, of course.


PROBLEMS WITH ORDER IDS:
If you are using any sort of modification that creates a customized order ID, like "ON389193" or something, here's how to make it work:

Open up the edit_orders.php file and replace all instances of:

(int)$oID

with:

$oID

... AAAAnd... save it!



--------------------------------------
MY OPTIONAL RECOMMENDATIONS FOR STEP 3
--------------------------------------
Open up your orders.php file, find the following line:
<td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

... it's normally on line 127, if you haven't changed the file. Change the code to:
<td class="pageHeading" align="right">
<?php echo '<a href="' . tep_href_link("edit_orders.php", tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> &nbsp; '; ?>
<?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?>
</td>

This should give you two buttons at the top-right of the order information/details screen. There should be a "edit" button and the default "back" button.



---------------------------------------------------------------
ADDITIONAL RECOMMENDATIONS FROM OTHER PEOPLE (NOT TESTED BY ME)
---------------------------------------------------------------

This will place an "edit" button next to the packing slip& invoice buttons in your order view. 

Original Code: 
     <tr> 
     <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>' ; ?></td> 
     </tr> 


New Code: 
     <tr> 
     <td colspan="2" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> <a href="' . tep_href_link(FILENAME_EDIT_ORDERS, 'oID=' . $HTTP_GET_VARS['oID']) . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>'; ?></td> 
     </tr> 

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

To place and "update" button on the main orders page find this around line 489: 

Original Code: 
     $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 
     $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_EDIT_ORDERS, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>'); 
     $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); 

New Code: 
     $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_EDIT_ORDERS, 'oID=' . $oInfo->orders_id). '">' . tep_image_button('button_update.gif', IMAGE_UPDATE) . '</a>'); 
     $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>'); 
     $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased)); 
 
You will also need to add the define in your admin/includes/filenames.php.

New Code: 
  define('FILENAME_EDIT_ORDERS', 'edit_orders.php'); 

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