Re: Order Editor 1.3.7 Issues
Quote:
Originally Posted by
gothstone
Ok, I went back and saw your previous post. A parse error, unexpected $end is usualy caused by a missing } somewhere in your code. I would pull a clean copy of /admin/orders.php and try editing it again. Its usualy faster to redo the mod then actualy try to find the typo burried in 1000+ lines of code.
I found the parse error in orders.php occurs at the end of the second replacement around line 917.
Quote:
if (sizeof($order->products) > 0) {
// ====> BOF: Edit Orders 1.2.6 <====
// $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
$contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDER_EDIT, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
// ====> EOF: Edit Orders 1.2.6 <====
}
break;
If you are not careful, the closing "}" just before the "break;" winds up on the commented EOF line above it and so is also commented out.
BUT once I cleared that up I get a parse error in admin/edit_orders.php at the last line. So I'm off on another hunt. :frusty:
Re: Order Editor 1.3.7 Issues
Quote:
Originally Posted by
ScrapHutInc
So, I managed to figure out my issues with the tax not calculating properly. There is a hard coded variable in the edit_orders.php file that specifies the shipping tax. I put in the right number here. This really should be read out of the database though, so I may change this later on.
As for discounts, it was not subtracting them from the total, nor was tax being calculated as a negative. Once again, the tax on this discount should be read from the database.
Now the issue I have is that the email does not work when updating the status or comments. I tried looking at the orders.php file to see what was different. The call to zen_mail was different. I fixed this up, but still have the same problem....
Email Error: Could not instantiate mail function. Please check Admin->Configuration->Email Options->Email Transport
Anyone else have this problem? I can't see how the edit_orders.php version is any different than the orders.php version.
just curious, how did you fix the tax problem, can you be more specific to what change you made please.
1 Attachment(s)
Re: Edit Orders 1.2.6 Issues
Hi to all,
I have been trying to plug the leaks in the admin/edit_orders.php file and here is what I got:
1. Some of the parse errors are caused by use of short php tags "<?". Rather than setting my php to use short tags, I searched the file with Notepad++ and replaced 9 instances of <? " with <?php ". When you do the search/replace be sure to include a space after the tag. That cured the problem.
BTW, I also noted an extra '</form> around line 995. Didn't seem to do anything if I commented it out.
2. The "Add Products" text was :yuck: so I created a button. You put this button in admin/includes/language/english/images/buttons. Then you have to make some modifications as follows:
Quote:
a. In yourcart/includes/languages/english/YOURTEMPLATE/button_names.php ADD the following line (in alphabetical sequence is fine or anywhere):
define('BUTTON_IMAGE_ADD_PRODUCT','button_add_product.gif');
b. in yourcart/admin/includes/languages/english.php ADD
define('IMAGE_ADD_PRODUCT','Add Product');
c. Now here's the tricky one - in the 'Orders Total' block in admin/edit_orders.php (around line 860)
FIND:
<td align='center' valign='top'><br><a href="<?php echo $PHP_SELF . "?oID=$oID&action=add_product&step=1"; ?>"><u><b><font size='3'><?php echo TEXT_DATE_ORDER_ADDNEW; ?> </font></b></u></a></td>
and REPLACE IT WITH:
<td align='center' valign='top'><br><a href="<?php echo $PHP_SELF . "?oID=$oID&action=add_product&step=1"; ?>"><?php echo zen_image_button('button_add_product.gif',IMAGE_ADD_PRODUCT) ?></a></td>
(Actually I prefer to comment out the old one and add the new one just in case.)
Now you will have a matching "Add Products" button. I have included the button image in the zip file with an updated version of edit_orders.php (including the fix by zc_tester for the delete bug).
I am still seeing a number of problems with my 1.38a version cart.
1. When I attempt to add a product with attributes, I get the drop down list of attributes, but after I select one and click the OK button, it reverts to the first attribute in the list.
2. The attribute did not show on the Order page or the Details page.
3. The mod should get the unit price from the database and add it to the order.
4. Attempted to DELETE and item by setting Quantity=0. When I click on the Update button I get the following error:
Quote:
"Fatal error:Cannot use object of type order as array in .../admin/edit_orders.php, line 271."
When I use the browser BACK button to get back to the Orders page, the item is deleted, BUT the TAX is not corrected as required AND the ORDER TOTAL is NOT changed. This may be due to the fact that I did not remove the unit price manually.
This is a very useful mod. I just which we could get all the bugs out of it. :frusty:
Re: Edit Orders 1.2.6 Issues
Small update:
I was able to simply adjust the prices on the EDIT page and the tax and totals recalculated correctly. One more little annoyance out of the way. :clap:
Now if I can only fix the problem with the attributes...
Re: Edit Orders 1.2.6 Issues
I've made all the changes you have recommended, thank you for the files and instructions - very good. No errors and looks like everything but shipping tax recalculations are working. can you let me know what you did to correct this.
Re: Order Editor 1.3.7 Issues
Hi,
Take a look at this, I might be on to something here? :huh:
http://www.oscommerce.com/community/contributions,1435/
PHP gurus might want to have a look at that OSC package.
(..catalog/admin/edit_orders.php)
This part is rather interesting:
PHP Code:
// Get the shipping quotes- if we don't have shipping quotes shipping tax calculation can't happen
$shipping_modules = new shipping;
$shipping_quotes = $shipping_modules->quote();
if (DISPLAY_PRICE_WITH_TAX == 'true') {//extract the base shipping cost or the ot_shipping module will add tax to it again
$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
$tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
$order->info['total'] -= ( $order->info['shipping_cost'] - ($order->info['shipping_cost'] / (1 + ($tax /100))) );
$order->info['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100)));
}
Could that somehow be ported to ZenCart / Edit Orders in order to get the shipping tax calculated correctly?
I really hope some PHP guru could make this work! Thanks in advance!
Re: Order Editor 1.3.7 Issues
Edit orders does not work correctly on my non profit website where there is no shipping or sales tax. When I alter a record, the total price goes to "Zero". Can you please tell me what I have to do to get this to work properly and to restore the total amounts to my site. Thank you.
www.buya.org
Re: Order Editor 1.3.7 Issues
Same here. Changing an item price resets everything at zero, and writes some <b> tags in the order total table...
Re: Order Editor 1.3.7 Issues
Hi, I installed this mod and am getting the following error when I try to add another product to an existing order:
1364 Field 'products_prid' doesn't have a default value
in:
[insert into orders_products set orders_id = 11133, products_id = 392, products_model = 'PD-0078', products_name = 'Siren', products_price = '155.0000', final_price = '155', products_tax = '0', products_quantity = 1;]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
Where did I go wrong?
Re: Order Editor 1.3.7 Issues
I deleted the table 'products_prid' & now adding products works 100%.
What is that table there for, could I just leave it deleted or does something else indeed use it?
One other issue I have is when I try to remove products from a order I get the following error page:
Fatal error: Cannot use object of type order as array in C:\Domains\thesourceltd.com\wwwroot\admin\edit_orders.php on line 271
This is what I find at line 271:
// 0 Quantity = Delete
$Query = "delete from " . TABLE_ORDERS_PRODUCTS . " where orders_products_id = '$orders_products_id';";
$db -> Execute($Query);
//UPDATE_INVENTORY_QUANTITY_START################################################# #############################################################
#$order = zen_db_fetch_array($order_query);
if ($products_details["qty"] != $order['products_quantity']){
$differenza_quantita = ($products_details["qty"] - $order['products_quantity']);
$db -> Execute("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity - " . $differenza_quantita . ", products_ordered = products_ordered + " . $differenza_quantita . " where products_id = '" . (int)$order['products_id'] . "'");
}
//UPDATE_INVENTORY_QUANTITY_END################################################### ###########################################################
$Query = "delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_products_id = '$orders_products_id';";
$db -> Execute($Query);
}
Is there anything wrong with this code?