EuroTimmy Posted August 15, 2007 Share Posted August 15, 2007 Does it display strangely during the checkout process as well? Or just in Order Editor? Hi maxxxie!! It seems to only be in the Order Editor... the rest of the site is perfect. It comes up with either: Foreign looking characters Truncated to being shorter than it should be (cutting off half the text) I think I would just like to parse the string and make it simply read AusPOST Parcel Post but just don't know where to begin... T Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 15, 2007 Share Posted August 15, 2007 Hello all, A huge thanks to djmonkey1 for a great contribution!! I have installed and am using Order Editor v5.0.2 and only have 1 issue to combat. This is what is in the 'Order Totals:' section for my shipping on orders when I first open the Order Editor. AusPOST Parcel Post (Delivery to Post Code: <b>3196</b><br>1 day(s) Estimated Delivery Time*<br>1 box @ 5.45kg(s)): It looks ugly and is causing problems being sent back and forth to the database... I want to just have AusPOST Parcel Post Being a newbie to PHP I'm not sure how I tell the order editor to look at the string and only write out up to the first instance of ( I think something like this should do it for me but not sure where (and what variable) to use it on??? $ot_shipping = substr($ot_shipping,0,strpos($ot_shipping, '(')-1) Any assistance is much appreciated Tim That string is what is being stored in the database during the checkout procedure. You need to edit the shipping module itself to not display that information. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 15, 2007 Share Posted August 15, 2007 Just an addendum to my last post, adjusting the quantity of an item also produces the same behaviour - the postage quote section disappears as does the subtotal section. Max What happens if you refresh the page? Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
nt13 Posted August 15, 2007 Share Posted August 15, 2007 I'm not saying that at all. Theoretically you could add a "tax-exampt" checkbox to the page that if checked would zero out all tax components, or just make the tax class for shipping to '0'. For instance in admin/edit_orders.php and admin/edit_orders_ajax.php if you find the code 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['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100))); } and after it add $GLOBALS[$module]->tax_class = 0; there will never be any shipping tax added to any order. So if you put the $GLOBALS[$module]->tax_class = 0; inside an if condition that checks for some setting or condition you can get rid of shipping tax pretty easily for whichever orders you want. This is really helpful. If I just detect that I have a non NULL VAT number stored for the customer then I can zero the tax. I'll have a look at this today. Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 15, 2007 Share Posted August 15, 2007 This is really helpful. If I just detect that I have a non NULL VAT number stored for the customer then I can zero the tax. I'll have a look at this today. In the event that you have Display Prices with Tax set to 'true' make sure your modifications are made to/inside the code 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['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100))); } or you'll get weird results. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
Silverado05 Posted August 16, 2007 Share Posted August 16, 2007 I just want to thank you djmonkey1 for your work and your support. I wish more would follow your lead. I have finished my testing with the latest release and integrating it with manual order maker and so far so good. I am have one small annoyance but I don't know if it is related to this contribution yet or not but I have officially taken this off the white board as completed. -Thanks again. Quote Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works. Link to comment Share on other sites More sharing options...
yedle Posted August 16, 2007 Share Posted August 16, 2007 Hi, i have little problem. After instalation if I add new product to order stay stock quantity some as before change, but if i delete product from order stock, quantity is changed ok. other function is ok. Can you know where is problem. Thank David Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted August 16, 2007 Share Posted August 16, 2007 Hello, I like the new update and how it gets the shipping prices! Nice work. One comment, not an issue, but if I was to write in the comments box that I have credited a customer £20 for example, once it is updated it adds a funny capital  infront of the pound sign, which it never used to Thanks Dave Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 16, 2007 Share Posted August 16, 2007 (edited) Hi, i have little problem. After instalation if I add new product to order stay stock quantity some as before change, but if i delete product from order stock, quantity is changed ok. other function is ok. Can you know where is problem. Thank David There is a lack of stock check code in edit_orders_add_product.php, an oversight on my part. I should be able to get a fix for this by the end of the day. The AJAX code may also lack stock checking code for updating products quantities, I'll look into that too. Edited August 16, 2007 by djmonkey1 Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 16, 2007 Share Posted August 16, 2007 Hello, I like the new update and how it gets the shipping prices! Nice work. One comment, not an issue, but if I was to write in the comments box that I have credited a customer £20 for example, once it is updated it adds a funny capital  infront of the pound sign, which it never used to Thanks Dave This looks like it might be another limitation of encodeURIComponent. It's not the greatest workaround but you could write GBP instead, or turn off the AJAX functions altogether. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 16, 2007 Share Posted August 16, 2007 I just want to thank you djmonkey1 for your work and your support. I wish more would follow your lead. I have finished my testing with the latest release and integrating it with manual order maker and so far so good. I am have one small annoyance but I don't know if it is related to this contribution yet or not but I have officially taken this off the white board as completed. -Thanks again. No problemo. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
yedle Posted August 16, 2007 Share Posted August 16, 2007 There is a lack of stock check code in edit_orders_add_product.php, an oversight on my part. I should be able to get a fix for this by the end of the day. The AJAX code may also lack stock checking code for updating products quantities, I'll look into that too. I have original edit_orders_add_product.php (5.0.2) and don´t change it. Please can you specifi part of this file who make stock downgrade? In admin i have AJAX use TRUE. Thanks Quote Link to comment Share on other sites More sharing options...
maxxxie Posted August 16, 2007 Share Posted August 16, 2007 What happens if you refresh the page? Hi DJ, If I refresh the page, I get the original order editing screen, complete the with the item(s) I just removed. In other words, it's as if I'd done nothing at all. This also happens when modifying quantities. I really like the idea of this contribution, and can't wait to start using it. Thankyou for all your help with it :) Max Quote Link to comment Share on other sites More sharing options...
maxxxie Posted August 16, 2007 Share Posted August 16, 2007 Just one more thing. I switched the AJAX stuff off, just to see if that's the problem. Now when I go into the order editor, there's instruction to click "update" to save all changes. Except there is no "update" (button or plain old link) to click. ARGGHH! Have I missed something? Have I done something dumb (entirely possible)? Max Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 16, 2007 Share Posted August 16, 2007 Hi DJ, If I refresh the page, I get the original order editing screen, complete the with the item(s) I just removed. In other words, it's as if I'd done nothing at all. This also happens when modifying quantities. I really like the idea of this contribution, and can't wait to start using it. Thankyou for all your help with it :) Max View the HTML source of edit_orders.php when viewing an order and find the javascript function updateOrdersField. It should look something like this: function updateOrdersField(field, value) { createRequest(); var url = "edit_orders_ajax.php?action=update_order_field&oID=2&field=" + field + "&new_value=" + value; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'orders')}}; xmlHttp.send(null); } //end function updatOrdersField Post what you find in your file. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 17, 2007 Share Posted August 17, 2007 Just one more thing. I switched the AJAX stuff off, just to see if that's the problem. Now when I go into the order editor, there's instruction to click "update" to save all changes. Except there is no "update" (button or plain old link) to click. ARGGHH! Have I missed something? Have I done something dumb (entirely possible)? Max Make sure you have uploaded all the files and performed all the changes as listed in the installation instructions. Also it could be a problem with the CSS. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
EuroTimmy Posted August 17, 2007 Share Posted August 17, 2007 Hi folks, I'm having troubles with the shipping and tax in the order totals. I need some assistance please... I thought I could fix this after reading the code but I'm not good enough. I am getting this as I modify anything to do with the shipping. On first view of an order, all totals are correct... as soon as I edit anything about shipping it does this calculation wrong. Sub-Total: $100.00 (Correct) Shipping: $10.00 (Correct) Tax: $10.00 (Correct) Total: $110.91 (Wrong by $0.91) The "Total:" line is adding a second helping of tax (10%) on the shipping fee which already has the tax included!! :) I know this is one I can beat... but only with help from you guys!! Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 17, 2007 Share Posted August 17, 2007 I have original edit_orders_add_product.php (5.0.2) and don´t change it. Please can you specifi part of this file who make stock downgrade?In admin i have AJAX use TRUE. Thanks In admin/edit_orders_add_product.php find //add on for downloads if (DOWNLOAD_ENABLED == 'true' && isset($filename[$option_id])) { $Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET orders_id = '" . tep_db_prepare_input($oID) . "', orders_products_id = '" . tep_db_prepare_input($new_product_id) . "', orders_products_filename = '" . tep_db_prepare_input($filename[$option_id]) . "', download_maxdays = '" . tep_db_prepare_input($maxdays[$option_id]) . "', download_count = '" . tep_db_prepare_input($maxcount[$option_id]) . "'"; tep_db_query($Query); } //end if (DOWNLOAD_ENABLED == 'true') { //end downloads } } BELOW that code add this: // Update inventory Quantity // This is only done if store is set up to use stock if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $_POST['add_product_quantity'] . " WHERE products_id = '" . $_POST['add_product_products_id'] . "'"); } // Update products_ordered info tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $_POST['add_product_quantity'] . " WHERE products_id = '" . $_POST['add_product_products_id'] . "'"); Next in admin/edit_orders_ajax.php find //2. Update the orders_products table for qty, tax, name, or model if ($action == 'update_product_field') { BELOW that code add: if ($_GET['field'] == 'products_quantity') { // Update Inventory Quantity $order_query = tep_db_query(" SELECT products_id, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); $orders_product_info = tep_db_fetch_array($order_query); // stock check if ($_GET['new_value'] != $orders_product_info['products_quantity']){ $quantity_difference = ($_GET['new_value'] - $orders_product_info['products_quantity']); if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } else { tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } //end if (STOCK_LIMITED == 'true'){ } //end if ($_GET['new_value'] != $orders_product_info['products_quantity']){ }//end if ($_GET['field'] = 'products_quantity' Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 17, 2007 Share Posted August 17, 2007 Hi folks, I'm having troubles with the shipping and tax in the order totals. I need some assistance please... I thought I could fix this after reading the code but I'm not good enough. I am getting this as I modify anything to do with the shipping. On first view of an order, all totals are correct... as soon as I edit anything about shipping it does this calculation wrong. Sub-Total: $100.00 (Correct) Shipping: $10.00 (Correct) Tax: $10.00 (Correct) Total: $110.91 (Wrong by $0.91) The "Total:" line is adding a second helping of tax (10%) on the shipping fee which already has the tax included!! :) I know this is one I can beat... but only with help from you guys!! Find in admin/edit_orders.php and admin/edit_orders_ajax.php (one occurrence in each file): 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['shipping_cost'] = ($order->info['shipping_cost'] / (1 + ($tax /100))); } and change it to 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))); } Thank you for pointing this out. Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
maxxxie Posted August 17, 2007 Share Posted August 17, 2007 View the HTML source of edit_orders.php when viewing an order and find the javascript function updateOrdersField. It should look something like this:function updateOrdersField(field, value) { createRequest(); var url = "edit_orders_ajax.php?action=update_order_field&oID=2&field=" + field + "&new_value=" + value; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'orders')}}; xmlHttp.send(null); } //end function updatOrdersField Post what you find in your file. Here's what I have: function updateOrdersField(field, value) { createRequest(); var url = "edit_orders_ajax.php?action=update_order_field&oID=50&field=" + field + "&new_value=" + value; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'orders')}}; xmlHttp.send(null); } //end function updatOrdersField RE your subsequent post - I've done it a few times over now, but will repeat it again when I get home tonight. Cheers, Max Quote Link to comment Share on other sites More sharing options...
EuroTimmy Posted August 17, 2007 Share Posted August 17, 2007 Thank you for pointing this out. Seriously!!! You are a legend! Thank you! The edited code (in your last post to me : above) worked a treat! Quote Link to comment Share on other sites More sharing options...
djmonkey1 Posted August 17, 2007 Share Posted August 17, 2007 Here's what I have: RE your subsequent post - I've done it a few times over now, but will repeat it again when I get home tonight. Cheers, Max What browser are you using, and are you getting any JavaScript errors from it? Quote Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread. Link to comment Share on other sites More sharing options...
VaM Posted August 17, 2007 Share Posted August 17, 2007 (edited) Ajax Order Editor is excellent! But i have one problem with charset (other than iso-8859-1, for example, problem with russian language charset windows-1251). All content in ajax order editor in UTF-8. For example, i change Shipping method and after reloading input filed with shipping method was filled with new shipping information BUT in UTF-8 encoding, not in windows-1251. How to use CHARSET constant defined in osCommerce ?! I change in /admin/edit_order_ajax.php // output a response header header('Content-type: text/html; charset=ISO-8859-1'); require('includes/application_top.php'); to: require('includes/application_top.php'); // output a response header header('Content-type: text/html; charset='.CHARSET.''); And problem resolved, but not for all ajax order editor. Comments still added in UTF-8 encoding and sending to customer in UTF-8. I wan't to see all information in CHARSET constant (for russian - CHARSET constant = windows-1251) P.S. Sorry for my english, i hope you understand me. Edited August 17, 2007 by VaM Quote Link to comment Share on other sites More sharing options...
yedle Posted August 17, 2007 Share Posted August 17, 2007 (edited) In admin/edit_orders_add_product.php find //add on for downloads if (DOWNLOAD_ENABLED == 'true' && isset($filename[$option_id])) { $Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET orders_id = '" . tep_db_prepare_input($oID) . "', orders_products_id = '" . tep_db_prepare_input($new_product_id) . "', orders_products_filename = '" . tep_db_prepare_input($filename[$option_id]) . "', download_maxdays = '" . tep_db_prepare_input($maxdays[$option_id]) . "', download_count = '" . tep_db_prepare_input($maxcount[$option_id]) . "'"; tep_db_query($Query); } //end if (DOWNLOAD_ENABLED == 'true') { //end downloads } } BELOW that code add this: // Update inventory Quantity // This is only done if store is set up to use stock if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $_POST['add_product_quantity'] . " WHERE products_id = '" . $_POST['add_product_products_id'] . "'"); } // Update products_ordered info tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $_POST['add_product_quantity'] . " WHERE products_id = '" . $_POST['add_product_products_id'] . "'"); Next in admin/edit_orders_ajax.php find //2. Update the orders_products table for qty, tax, name, or model if ($action == 'update_product_field') { BELOW that code add: if ($_GET['field'] == 'products_quantity') { // Update Inventory Quantity $order_query = tep_db_query(" SELECT products_id, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); $orders_product_info = tep_db_fetch_array($order_query); // stock check if ($_GET['new_value'] != $orders_product_info['products_quantity']){ $quantity_difference = ($_GET['new_value'] - $orders_product_info['products_quantity']); if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } else { tep_db_query ("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } //end if (STOCK_LIMITED == 'true'){ } //end if ($_GET['new_value'] != $orders_product_info['products_quantity']){ }//end if ($_GET['field'] = 'products_quantity' SUPER NOW is editing OK. My last problem with code on pages. Because I have page in another language (czech) have trouble with write to database. In other part of shop is editing OK. When I use code Windows-1250 i change in editorder.php this */ // charset for web pages and emails define('CHARSET', 'windows-1250'); here is sample BEFORE EDIT: - here is OK here is picture when EDITing : - here is OK after send comments or select shipping : - here is bad code for my language. I test today ORDER EDIT and other function is very good. I make only language modul for CZECH. Edited August 17, 2007 by yedle Quote Link to comment Share on other sites More sharing options...
Sappie Posted August 17, 2007 Share Posted August 17, 2007 After applying the above fix, I get the following error: Fatal error: Call to undefined function: tep_hide_session_id() in /var/virtual/web/user/html/catalog/admin/orders.php on line 333 Before applying the fix, there was not such an error. Can anyone suggest a solution? The function tep_hide_session_id() is defined at catalog/includes/functions/html_output.php. As far as I know it is not used at all on the admin side. The fix above did not include any changes to admin/orders.php nor did it include the use of the function tep_hide_session_id(). Hi! Firstly, thanks for this wonderful contribution. I have just installed osCommerce and this is the very first contribution I have tried to install. Since I didn't have any other editions, I basically uploaded the required folders/files into their respective and overwrite the existing. When I test to edit the order, I receive the same error as jimmydagoogler. Any guide or suggestion would be deeply appreciated~ :blush: 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.