Zen Cart Logo
Forums / Addon Admin Tools / Edit Orders v4.0 Support Thread

Edit Orders v4.0 Support Thread

Views: 346,058

Results 1,201 to 1,220 of 1,927
7 Feb 2018, 5:23 PM
#1201
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Edit Orders v4.0 Support Thread

The following files are attached (the log file will be in the next post):

  1. debug_edit_orders_1222.txt (log file edited to change admin directory name and customer email address)
  2. Admin New Order Detail Page.jpg - screen shot of portion of orders details for order created with Admin New Order and Edit Orders with incorrect total
  3. Admin New Order after shipping update.jpg - screen shot of portion of edit orders screen after adding shipping charge and clicking update showing incorrect total
  4. Admin New Order after product add.jpg - screen shot of portion of edit orders screen after adding product with quantity discount
  5. Store order detail.jpg - screen shot of portion of store-side order confirmation page showing correct total
    Zen Cart v155e, Quantity Discount v1.12.1, Edit Orders v4.3.1, Admin New Orders v1.4.1 (edited to delete ot_tax.php from list of order totals modules). The product has $1.00 off each item for 5 or more. The product cost is $6.00, on sale for 50% off or $3.00 per item. Tax rate is 6% on the product and shipping.

The subtotal, quantity discount, shipping, PA tax line items are all correct for the new order created in Admin New Order and Edit Orders, but the total line item is incorrect, being too low by an amount that equals the tax on the quantity discount ($0.30).

Attachment 17685
Attachment 17686
Attachment 17687
Attachment 17688

7 Feb 2018, 5:29 PM
#1203
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Have you tried creating a "normal" order with the same products, totals, etc?

7 Feb 2018, 6:05 PM
#1204
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Yes, I did a normal purchase of the same product from the store-side. As noted above, the total is correct. See Store order detail.jpg file in post 1198, list item 5, and the first file attached.

7 Feb 2018, 6:27 PM
#1205
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Dave224:

Yes, I did a normal purchase of the same product from the store-side. As noted above, the total is correct. See Store order detail.jpg file in post 1198, list item 5, and the first file attached.
... and you're having difficulties using EO to edit that order (or one created by your modifications to Admin New Order)?

7 Feb 2018, 6:36 PM
#1206
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

one created by by my modified Admin New Order.

7 Feb 2018, 6:45 PM
#1207
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Dave224:

one created by by my modified Admin New Order.
I'll suggest placing a "normal" order via the storefront and then placing the same order with your modifications, comparing the order-related database elements between the two to see what's different.

9 Feb 2018, 10:05 PM
#1208
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Comparing the database tables did not reveal anything unusual except the orders_total table for ot_total class was different, as expected. Also, the order of the classes in the orders_total table differed, with ot_shipping being the last entry for the order created using Admin New Order/ Edit Orders, but I don't think this is an issue.

I have struggled through the Edit Order code and debug log for the order. After the product is added and before shipping is added, at the step where getOrderInfo is called by edit_orders.php on line 655, everything looks correct including ot_total at this point. At the point where eo_update_database_order_totals, taxes/totals on entry called by edit_orders.php on line 656, everything looks correct. Then Checking taxes for ot_quantity_discount is encountered, followed by eo_update_database_order_totals, after_adjustments. After checking the order for virtual status, eo_update_database_order_totals, after process shows the first occurrence where order_total is incorrect. It's too low by the tax on the quantity discount. Specifically $order->info['total'] is wrong at this point.

Problem is, I get lost trying to follow the code in store-side ot_total class, which I think is called just before $order->info['total'] is printed at the point above. Any help would be appreciated. Could this problem be associated with the fixes for GitHub issue #56?

10 Feb 2018, 12:21 PM
#1209
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Dave224:

Comparing the database tables did not reveal anything unusual except the orders_total table for ot_total class was different, as expected. Also, the order of the classes in the orders_total table differed, with ot_shipping being the last entry for the order created using Admin New Order/ Edit Orders, but I don't think this is an issue.

I have struggled through the Edit Order code and debug log for the order. After the product is added and before shipping is added, at the step where getOrderInfo is called by edit_orders.php on line 655, everything looks correct including ot_total at this point. At the point where eo_update_database_order_totals, taxes/totals on entry called by edit_orders.php on line 656, everything looks correct. Then Checking taxes for ot_quantity_discount is encountered, followed by eo_update_database_order_totals, after_adjustments. After checking the order for virtual status, eo_update_database_order_totals, after process shows the first occurrence where order_total is incorrect. It's too low by the tax on the quantity discount. Specifically $order->info['total'] is wrong at this point.

Problem is, I get lost trying to follow the code in store-side ot_total class, which I think is called just before $order->info['total'] is printed at the point above. Any help would be appreciated. Could this problem be associated with the fixes for GitHub issue #56?
The issue has something to do with how Admin Add New Order does its processing and does not, IMO, have anything to do with issue #56.

Might I suggest an alternate approach to creating orders for customers: Encrypted Master Password. That allows you and/or a group of admins to place an order on behalf of the customer, logging into the customer's account with their admin password.

10 Feb 2018, 2:38 PM
#1210
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

I respectfully disagree. I just ran another case where I created an order on the store-side, then went to edit orders. I added a product with a quantity discount in edit orders. The subtotal, discount, shipping, and tax were correct, but the order total was too low by $0.06. Then I clicked update, got a successful update message, and the subtotal, discount, shipping, and tax were the same and correct, but the order total was too low by the tax on the discount, exactly the same behavior that I saw when editing an order started in Admin New Order. I think there's a problem with Quantity Discount or a problem in Edit Orders with discounts. I plan to run further tests. Sorry for being a PIA on this problem.

10 Feb 2018, 2:53 PM
#1211
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Dave224:

I respectfully disagree. I just ran another case where I created an order on the store-side, then went to edit orders. I added a product with a quantity discount in edit orders. The subtotal, discount, shipping, and tax were correct, but the order total was too low by $0.06. Then I clicked update, got a successful update message, and the subtotal, discount, shipping, and tax were the same and correct, but the order total was too low by the tax on the discount, exactly the same behavior that I saw when editing an order started in Admin New Order. I think there's a problem with Quantity Discount or a problem in Edit Orders with discounts. I plan to run further tests. Sorry for being a PIA on this problem.
Now we're getting somewhere! With all the discussion of integration with Admin New Order and your changes there-to, I missed the discussion where there's an EO issue with quantity discounts.

I'll look into that over the weekend.

10 Feb 2018, 4:02 PM
#1212
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

There's a bug and correction in Quantity Discounts, reported in Quantity Discounts support thread in post #805. It has no effect on what I'm seeing in EO. I get the same result with and without the patch. The patch was in for my initial testing of EO. Then I took it out for my later testing and put it back in for tests after post #1207.

Please note that problems with the order total when a product with quantity discount is added in EO occurs without me using Quantity Discount in the EO drop-down menu.

I hope the information I am posting is helpful to you. If you want me to run specific test cases, I would be glad to do so.

10 Feb 2018, 4:22 PM
#1213
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Ran a case where a product with quantity discount was ordered on the store-side. Subtotal, discount, shipping, tax and total were all correct on the store side. Went in to EO to add a non-discountable taxable product. At EO entry, the subtotal, discount, shipping, tax and total were all correct. After adding a non-discountable product and before clicking update, the subtotal, discount, shipping, and tax were correct, but the total was incorrect but not by an amount equaling the tax on the discount. After clicking update, subtotal, discount, shipping, and tax were correct, and the total was too low by the tax on the discount, as I have been reporting.

So, it makes no difference whether the quantity discountable product was in the store order or added in EO, the result is the same. The order total is too low by the tax on the discount after clicking update.

10 Feb 2018, 5:08 PM
#1214
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,955
Plugin Contributions:
8

Re: Edit Orders v4.0 Support Thread

lat9:

Might I suggest an alternate approach to creating orders for customers: Encrypted Master Password. That allows you and/or a group of admins to place an order on behalf of the customer, logging into the customer's account with their admin password.

personally, i am a BIG fan of this approach.

i applaud @lat9 in getting this code into some sort of workable shape, but i have found EMP to be a good solution for admins needing to enter customer orders.

10 Feb 2018, 5:20 PM
#1215
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Ran another test case involving group discount and not quantity discount. In this case I ordered a non-quantity discountable but group discountable product on the store side, and added another non-quantity discountable but group discountable item in EO. At EO entry, subtotal, group discount, shipping, tax and total were all correct. After adding the product in EO, the subtotal, group discount, and shipping were correct. The tax was too high by 1 cent, and the total was incorrect. After clicking update, the tax was still off by one cent, and the total was the correct total for the subtotal, group discount, shipping and tax shown.

The total was NOT too low by the discount as seen in tests involving quantity discount. So EO is not encountering the problem with group discounts.

I suspect the tax error was caused by rounding up rather than rounding down somewhere. Repeating the order on the store side gave the correct tax.

10 Feb 2018, 5:41 PM
#1216
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Ran another test with both quantity discount and group discount involved. In this test, I ordered a non-quantity discountable product and a quantity-discountable product on the store-side. Both products subject to group discount. Subtotal, quantity discount, group discount, shipping, tax and order total were correct. After EO entry, the totals were all the same. Now, instead of adding any products, I just clicked update. The subtotal, quantity discount, group discount, shipping and tax were correct. The total was too low by an amount that equals the tax on the sum of the quantity discount and member discount!

So something goes wrong when update is clicked and a quantity discount is present. It doesn't matter if the quantity discount product was added by EO or was in the original order, the result is that the order total is too low by the sum of quantity and group discounts. If group discount is not present, the total is too low by the tax on the quantity discount. I have no way of seeing if any other discount types affect the total.

As a side note, on the EO page, the quantity discount is editable and in a box. There is no minus sign displayed and the number is displayed to four places to the right of the decimal point. The group discount is not editable, there is a minus sign and no box. The value is displayed with two decimal places. Not sure if this is significant to the problem at hand.

10 Feb 2018, 5:54 PM
#1217
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

With edits...

Ran another test with both quantity discount and group discount involved. In this test, I ordered a non-quantity discountable product and a quantity-discountable product on the store-side. Both products were subject to group discount. Subtotal, quantity discount, group discount, shipping, tax and order total were all correct. After EO entry, the totals were all the same and correct. Now, instead of adding any products, I just clicked update. The subtotal, quantity discount, group discount, shipping and tax were all correct. The total was too low by an amount that equals the tax on the sum of the quantity discount and member discount!

So something goes wrong when update is clicked and a quantity discount is present. It doesn't matter if the quantity discount product was added by EO or was in the original order, the result is that the order total is too low by the tax on the sum of quantity and group discounts. If group discount is not present, the total is too low by the tax on the quantity discount. I have no way of seeing if any other discount types affect the total.

As a side note, on the EO page, the quantity discount is editable and in a box. There is no minus sign displayed and the number is displayed to four places to the right of the decimal point. The group discount is not editable, there is a minus sign and no box. The value is displayed with two decimal places. Not sure if this is significant to the problem at hand.

10 Feb 2018, 6:01 PM
#1218
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

carlwhat,

I also am very grateful to lat9 for what she has done with Edit Orders. But the issue being addressed is not Admin New Order or EMP any longer. The issue is incorrect order totals when a quantity discount is present. And we still have not found out if the problem is in Quantity Discount or in EO. Thank you for your endorsement of EMP.

11 Feb 2018, 2:02 PM
#1219
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

@Dave224, I appreciate the testing that you're doing to identify the issue(s) but the information you've supplied so far doesn't have enough information for me to replicate. You've probably identified some of this before, but a consolidation is appreciated:

Zen Cart version
EO version
Plugins installed (name/version)

When you click "Update" are you also ticking the "Recalculate totals" checkbox?

11 Feb 2018, 3:32 PM
#1220
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

ZC 1.5.5e

edit_orders v4.3.1 (without your proposed mod in EO support thread post #1182, so as-released EO 4.3.1)
quantity discount v1.11 (with mod in quantity discount support thread post #805 and my discount categories, levels and amounts)
admin_new_customer v1.4
admin_new_order v1.4.1 (with mods to avoid calling ot_tax.php)
stock_by_attribute v1.5.3
shipping_by_quote v2.3
product_cost_display v1.1.0

Recalculate totals checkbox is ticked by default.

Hope this helps.